How-toMarch 17, 2026·9 min read

How Do QR Codes Work?

A QR code isn't magic. It's a structured grid of black and white squares — called modules — encoding binary data using a well-defined spec. Once you understand the structure, you can even read one by eye (slowly, with practice). Here's what's actually happening when your phone takes that fraction of a second to pop open a link.

The building blocks: modules and finder patterns

Every QR code is a square grid of modules — those individual black or white squares. The size of the grid depends on how much data the code holds: the smallest are 21×21 modules; the largest are 177×177. The three large square blocks in the corners (top-left, top-right, bottom-left) are called finder patterns. They give the scanner a quick way to recognize "hey, this is a QR code" and to figure out which way is up. The asymmetry — three corners, not four — is what tells the decoder the orientation. Smaller alignment patterns scattered through the code help correct for distortion (curved surfaces, photo angles, lens warp). Around the edges, timing patterns — alternating black and white modules — give the scanner a ruler to measure the grid against. Everything else, the bulk of the code, is data and error correction.

Encoding modes

QR codes can encode different types of data, and each one has its own storage efficiency: Numeric (digits 0-9 only): most efficient, up to ~7,000 digits in the largest code Alphanumeric (digits + uppercase letters + a few symbols): less efficient, ~4,000 chars Byte (any 8-bit data, including UTF-8 text): less efficient still, ~2,900 bytes Kanji (specifically for Japanese characters): more efficient than byte for Japanese text The mode is signaled in a 4-bit header at the start of the data. A QR generator picks the most efficient mode for whatever you give it — if you encode a URL, it might use alphanumeric (for the all-caps domain) and byte (for the path). The code can even switch modes mid-encoding to save space. The scanner doesn't see this; the spec handles all of it transparently.

Error correction: why your logo doesn't break the scan

QR codes use Reed-Solomon error correction. Alongside the data, extra parity bytes get encoded so the scanner can rebuild missing or damaged data on the fly. There are four levels: L (low): recovers up to ~7% damage M (medium): up to ~15% Q (quartile): up to ~25% H (high): up to ~30% Higher correction = more parity bytes = more modules in the grid for the same data. So the higher you go, the visually denser the code gets. Here's where it gets practical: if you put a logo in the center of a QR (covering up to 30% of the area), error correction at level H can reconstruct the data behind the logo. The scanner doesn't experience the logo as missing data — it sees missing modules, then recomputes them from the parity bytes. That's the whole reason branded QR codes with centered logos still scan reliably.

What happens when you scan

Your phone's camera captures an image. The QR decoder library — built into iOS and Android natively — then runs through this: 1. Locate the finder patterns. Find the three large corner squares. Their arrangement tells the decoder where the grid is and which way it's facing. 2. Sample the modules. Walk the grid, reading each square as black (1) or white (0). The alignment patterns help correct for skew, distortion, and curvature. 3. Read the format info. A specific strip of modules near the finder patterns tells the decoder which QR version (grid size) and which error correction level the code uses. 4. Reconstruct the data. Run Reed-Solomon to fix any errors, then decode the bitstream using the encoding mode flagged in the header. 5. Hand off the result. The decoded string goes to the camera app, which decides what to do with it — open a URL, save a contact, prompt you to join a WiFi network, and so on. All of this happens in roughly 100ms on a modern phone.

Why some QR codes don't scan

When a scan fails, it almost always comes down to one of four things: Insufficient contrast. The decoder needs a clear difference between dark and light modules. Light grey on cream, or dark blue on dark grey, can confuse it. Distortion. Curved print surfaces, photos taken at extreme angles, or low-resolution prints can blur the grid. Alignment patterns help, but only so far. Damage that exceeds error correction. A code printed at level L (7% recoverable) with a smudge over 10% of its area is just gone. Logo over critical patterns. Logos placed over the finder patterns (corners) or the timing strips break the scanner's ability to orient. Always put logos in the center of the data area; never decorate the corners. The Build QR generator defaults to high error correction, which absorbs most of these issues. But if you're printing at scale, always test with multiple phones in your actual print conditions before committing.

FAQ

Are QR codes a proprietary standard?
No. QR codes were invented by Denso Wave in 1994 and released as an open standard (ISO/IEC 18004). Anyone can implement a QR encoder or decoder, free of charge or restriction.
How much data can a QR code hold?
The largest QR code (version 40, 177×177 modules) can hold up to ~4,300 alphanumeric characters or ~2,900 bytes at low error correction. In practice, codes longer than ~300-500 characters become visually dense and start to scan unreliably.
Why are there three big squares in the corners?
Those are finder patterns — they let the scanner detect the code and figure out its orientation. The three-square arrangement is asymmetric (three corners, not four), which is how the decoder knows which way is up.
Can a QR code carry a virus?
The QR code itself just encodes data — usually a URL. The URL could link to a malicious site, but the QR itself can't carry a virus. Treat scanning a QR like clicking a link: trust the source first.
Why do some QR codes look denser than others?
Denser codes either encode more data, or use higher error correction (more parity bytes), or both. The grid size scales with each. A long URL at high error correction produces the busiest-looking code.

Related reading & tools

Generate a QR code now

Now you know how they work. Make one in 30 seconds — free, no signup.

Start free