How Do QR Codes Work? The Parts of a QR Code and How Phones Read Them

A QR code looks like random noise, but every square has a job. Some squares help a camera find the code and straighten it out, some describe how the code was built, and the rest hold your data plus extra information that lets the code survive scratches and smudges. Once you understand those parts, it becomes much easier to make QR codes that scan reliably.

QR stands for Quick Response. The format was created in 1994 by Denso Wave, a Japanese company, to track automotive parts, and it is defined today in the international standard ISO/IEC 18004.

The short answer

The parts of a QR code

Finder patterns

The three big squares in the top-left, top-right and bottom-left corners are finder patterns. Each is 7 by 7 modules: a dark square ring, a light ring and a solid dark center. Their distinctive proportions are easy for software to spot from any angle, and because there are only three (not four), the scanner can also tell which way up the code is. That is why you can scan a QR code sideways or upside down.

Separators and quiet zone

Each finder pattern is surrounded by a thin light border, and the whole code needs a light margin around it called the quiet zone. The standard calls for a margin 4 modules wide. Without it, the scanner can confuse the code's edge with whatever is printed next to it. Our QR code quiet zone guide explains why cropping that margin is a common cause of failed scans.

Timing patterns

Between the finder patterns run two lines of alternating dark and light modules, one horizontal and one vertical. These timing patterns act like a ruler, telling the scanner how big each module is and where the rows and columns fall.

Alignment patterns

Larger codes include one or more smaller squares called alignment patterns. They help the scanner correct for distortion when the code is printed on a curved surface or photographed at an angle. The smallest version of a QR code has none; bigger versions have more.

Format and version information

Next to the finder patterns are small strips of format information. They record which error correction level and which mask pattern the code uses (more on both below), and they are stored twice so they can survive damage. Larger codes, version 7 and above, also include version information that describes the code's size.

Make a free QR code for a link, WiFi or contact card — generated in your browser.

Open the free QR code generator →

Versions: how big a QR code can be

QR codes come in 40 versions, which set the size of the grid:

The more data you store, the higher the version needs to be, and the denser the code looks. Our guide to how much data a QR code can hold explains the limits and why shorter content gives you a simpler, more scannable code.

How your data becomes squares

1. Choosing an encoding mode

The text is first converted into bits using the most compact mode available:

ModeWhat it stores
NumericDigits 0 to 9 only
AlphanumericDigits, uppercase A to Z, space and a few symbols
ByteAny text, including lowercase letters and most web addresses
KanjiJapanese characters

Numeric mode packs the most characters into a given space, which is why a code holding only a number can be very small.

2. Adding error correction

The data bits are grouped into 8-bit codewords, and the encoder adds extra codewords calculated with Reed-Solomon error correction, the same family of math used on CDs and DVDs. If some modules are dirty, torn or covered, the scanner can rebuild the missing data from those extra codewords.

There are four levels, L, M, Q and H, which can recover roughly 7%, 15%, 25% and 30% of the codewords respectively. Higher levels are more robust but need more modules. See QR code error correction levels for how to choose.

3. Placing the bits

The codewords are laid into the grid in a zigzag path, two columns at a time, starting from the bottom-right corner and skipping the areas reserved for finder, timing and alignment patterns and format information.

4. Masking

Finally, the encoder applies a mask: a fixed pattern that flips some modules from dark to light and back. Without masking, some data could produce large solid blocks or shapes that look like finder patterns and confuse scanners. The standard defines eight mask patterns; the encoder tests them, scores each for problems, picks the best and records its choice in the format information so the scanner can undo it.

What happens when you scan a QR code

When you point your phone at a code, the camera software goes through roughly these steps in a fraction of a second:

  1. Find the three finder patterns in the camera image.
  2. Correct the perspective, using the finder and alignment patterns to turn a tilted view back into a flat square.
  3. Measure the grid using the timing patterns, then read each module as dark or light.
  4. Read the format information to learn the error correction level and mask.
  5. Remove the mask, read the codewords in the same zigzag order and fix errors with Reed-Solomon decoding.
  6. Decode the text according to its encoding mode.
  7. Interpret the content. If the text starts with https://, the phone offers to open a website. If it follows the Wi-Fi format, it offers to join a network. A vCard becomes a contact.

That last step explains a useful fact: a QR code itself is just text. A Wi-Fi QR code, for example, contains a short line of text with the network name, security type and password in a standard format, which the phone recognizes. Our Wi-Fi QR code guide shows how to make one.

Do QR codes need the internet?

Reading a QR code does not. All the information is stored in the pattern itself, so a scanner can decode it offline. But if the code contains a web link, you need a connection to open the page.

This is also the difference between static and dynamic QR codes. A static code holds your final content directly. A dynamic code holds a short link to a service that redirects to your content, which lets you change the destination later but depends on that service staying online. Our guide to static vs dynamic QR codes compares them in detail.

What this means for making QR codes that scan

Knowing how scanners work points to a few practical rules:

If a code still will not scan, our QR code not scanning guide walks through the usual fixes.

Frequently asked questions

How does a phone know where the QR code is?

It looks for the three large finder patterns in the corners. Their fixed proportions are easy to detect, and their positions tell the phone the code's size, angle and orientation.

Can a QR code work if part of it is damaged?

Often, yes. Error correction lets a scanner rebuild missing data, up to roughly 30% of the codewords at the highest level, as long as the finder patterns and format information can still be read.

Do QR codes store the website itself?

No. A QR code stores only text, such as a web address. Your phone then opens that address using the internet.

Why do some QR codes look denser than others?

They hold more data or use a higher error correction level, which requires a larger version with more, smaller modules.

Are QR codes safe to scan?

Scanning only reads text, but the link it contains could lead anywhere. Check the address your phone shows before opening it. Our guide on how to check if a QR code is safe has a short checklist.

Make a free QR code for a link, WiFi or contact card — generated in your browser.

Open the free QR code generator →

Keep reading