Enqre
Back to blog

Published on 8/6/2026

How Do QR Codes Work? What Every Part of the Pattern Is For

How Do QR Codes Work? What Every Part of the Pattern Is For

A phone reads a QR code in about a tenth of a second, and the process is the same every time: find the three corner squares, work out the grid, read a strip that says how the rest is encoded, undo a scrambling pattern, then reassemble the data and repair whatever was damaged.

Every square in the pattern belongs to one of those steps. Here is which.

The three corner squares: finding and orienting

The big squares in three corners are finder patterns. They are the first thing a scanner looks for, and their ratio of dark to light bands — 1:1:3:1:1 along any line through the middle — is deliberately rare in ordinary images, so the camera can spot them in a cluttered photograph.

Three, not four, is the whole trick: three corners define which way is up. That is why a code scans upside down or at an angle, and why covering one corner kills it outright no matter how much error correction you paid for.

The dotted lines: setting the grid

Between the finder patterns run single lines of alternating dark and light modules — the timing patterns. They tell the scanner how many modules the code is across, so it can lay a grid over the image and know where each cell falls. Without them, a slightly rotated photo would drift out of alignment halfway across the code.

The small squares: correcting for a curved surface

From version 2 upwards, smaller alignment patterns appear inside the body of the code. They are reference points that let the scanner undo distortion — a code on a bottle, a curved label, or a photograph taken from the side. The bigger the code, the more of them it carries.

The strip beside the corners: the settings

Wrapped around the finder patterns is the format information: the error correction level, and which of eight mask patterns was applied. It is read before the data, because the data cannot be interpreted without it. It carries its own small protection, separate from the level you chose — which is why the "30% damage" figure never applied to it.

Masking: why two codes for the same link look different

Raw encoded data often produces large blank areas or stripes, and those confuse a camera — worse, they can imitate a finder pattern. So the encoder XORs the data with one of eight mask patterns, scores the result for undesirable features, and keeps the best one.

This is why the same URL can produce visibly different patterns in different tools, and why you cannot "read" anything by eye from the arrangement of the dots.

How the data is laid out

Data is written in two-module-wide columns, starting at the bottom right and snaking upward, then down, then up — around the function patterns, never through them. Four encoding modes exist, and the encoder picks the tightest one that fits: numeric, alphanumeric, byte (which covers ordinary URLs), and kanji.

The size is expressed as a version, from 1 to 40 — 21×21 modules up to 177×177, four more modules per side each step. At the very top, a version 40 code at the lowest error correction holds about 7,089 digits or 4,296 alphanumeric characters. In practice nobody prints that: it is a dense grid no phone camera resolves at a sensible size.

Error correction: the second copy

Part of every code is Reed–Solomon recovery data — a mathematical second copy that lets a scanner rebuild what it cannot read. Four levels exist: roughly 7%, 15%, 25% and 30% of the data area recoverable, from L to H.

That budget is what pays for a logo in the middle, for a scratch, for rain on a sticker. It is also the reason a higher level makes the pattern denser: the recovery data has to go somewhere.

The white border is part of the code

The quiet zone — four modules of clear space all round — is not decoration. It is how the scanner knows where the code ends and the world begins. A decorative border drawn tight against the pattern removes it, and this is one of the most common reasons a beautiful printed code will not scan.

What a dynamic code actually contains

A common misconception is that a dynamic QR code stores your destination and somehow updates itself. It cannot: the pattern is fixed the moment it is printed.

What it encodes is a short link — a domain and a handful of characters. Scanning it opens that short link, which forwards to wherever the code currently points. Change the destination and every printed copy follows, because nothing about the printed pattern has to change.

There is a practical side effect worth knowing: because a short link is only a few dozen characters, the code stays at a low version with large, robust modules. A static code holding a long URL with campaign parameters needs a much denser grid at the same physical size — which is exactly the code that fails on a poster.

Quick answers

  • What are the three big squares? Finder patterns. They let the scanner locate the code and work out its orientation.
  • Why does a code scan upside down? Because three corners are enough to define which way is up.
  • What are the small squares inside? Alignment patterns, which correct for distortion on curved or angled surfaces.
  • Why do two codes for the same link look different? Masking. The encoder picks whichever of eight patterns scores best.
  • How much data fits? Up to about 7,089 digits at the largest version and lowest error correction — far more than is practical to print.
  • Is the white border optional? No. The quiet zone is how the scanner finds the code's edges.
  • Does a dynamic code store my link? No. It stores a short link that forwards, which is why the destination can change without reprinting.

Keep reading