How QR Codes Work
At first glance a QR code looks like random noise. Under the hood it's a carefully designed two-dimensional grid that stores data redundantly enough to survive dirt, damage, and bad lighting. This article explains the pieces you can see — and the clever error-correction maths you can't — in plain language.
The basic idea: modules on a grid
A QR code is a square grid of small black and white cells called modules. Each module is one bit of information: black is a 1, white is a 0. The scanner samples the grid, reads the pattern as a stream of bits, and reassembles the text you encoded. That's the whole concept — everything else is engineering that makes it fast, robust, and readable at odd angles.
The three corner squares: finder patterns
Look at any QR code and you'll see three identical square-in-a-square patterns — one in each corner except the bottom-right. These are the finder patterns, and they do exactly what the name suggests: they let the camera find the code and work out its orientation. The 1:1:3:1:1 ratio of dark and light rings is unique enough that the scanner can pick it out even in a cluttered scene, no matter how the code is rotated or flipped. With three corner patterns located, the software calculates the grid size and skew, then samples each cell.
Why it reads at any angle
This is the big difference from a traditional barcode. A barcode is one-dimensional — it stores data as a horizontal strip and must be scanned roughly level. A QR code stores data in two dimensions and is anchored by those three corner patterns, so the scanner can work out the perspective from any angle. Flip it upside down and it still reads. Photograph it from a slight angle and the software mathematically de-skews the grid before reading it.
Encoding: how text becomes bits
Before anything is drawn, the text is converted to binary using the most compact mode it supports:
- Numeric mode — digits only, packed three at a time (the densest storage).
- Alphanumeric mode — uppercase letters, digits, and a small set of symbols.
- Byte mode — UTF-8 text and arbitrary data, which is what most real-world codes use.
- Kanji mode — a specialised encoding for Japanese characters.
The bit stream is then spread across the grid in a deliberate, zig-zagging path that's designed to smear damage across the whole code rather than wiping out one region — this is called masking, and the chosen pattern is itself recorded so the scanner can reverse it.
Reed–Solomon error correction: the real magic
Here's where QR codes get genuinely clever. Alongside your data, the code stores Reed–Solomon error-correction bytes — extra information computed from the data using polynomial maths. This redundancy means the scanner can reconstruct missing modules instead of failing. There are four levels, and you choose how much redundancy to trade away:
| Level | Data recoverable | Best for |
|---|---|---|
| L (Low) | ~7% | Clean digital screens |
| M (Medium) | ~15% | General printing, the common default |
| Q (Quartile) | ~25% | Codes with a logo in the centre |
| H (High) | ~30% | Harsh environments, stickers, packaging |
This is why a code with a sticker over part of it, a coffee ring, or a logo in the middle can still scan — the missing modules are treated as errors and repaired. SajiloQR generates codes at the highest level (H), so the codes you make have the best chance of surviving the real world.
Versions and capacity
QR codes come in 40 numbered "versions", from a 21×21 grid (Version 1) up to 177×177 modules (Version 40). More data needs more modules, which means a denser, busier-looking code that's harder to scan at small sizes. In practice, a URL is a few dozen characters and sits comfortably in a small, sparse code:
| Data type | Maximum capacity | Typical use |
|---|---|---|
| Numbers only | 7,089 digits | Reference IDs, tracking numbers |
| Letters & numbers | 4,296 characters | URLs, product codes |
| Bytes (UTF-8 text) | 2,953 bytes | Free text, most real-world content |
The practical lesson: keep your content short. A short URL makes a sparse code that's easy to scan from across the room; a paragraph of text makes a dense one that needs to be big and close.
Alignment and timing patterns
Beyond the corner finders, larger codes carry two more helper systems. Alignment patterns — smaller square-in-square marks — appear in the interior of big codes so the scanner can correct for distortion as it works across the grid. Timing patterns are alternating black-and-white rows/columns that tell the scanner exactly where one module ends and the next begins, keeping the sampling grid accurate.
Quiet zone: the border that matters
A QR code needs a clear white margin around it called the quiet zone, at least four modules wide. It's not decoration — the scanner uses it to tell where the code ends and the world begins. When codes sit flush against other graphics or text, scanning fails. This is why SajiloQR's PNG download already includes the quiet zone for you.
Putting it all together
So the full picture is: your text becomes bits, the bits are split into data and error-correction blocks, the blocks are woven across a grid, helper patterns are added for locating and aligning, and the whole thing is masked and bordered by a quiet zone. When a camera scans it, the finder patterns orient the reader, the timing patterns keep it aligned, the mask is reversed, the bits are read back, and the Reed–Solomon bytes quietly repair anything damaged along the way.
It's an elegant system — and you can put it to work right now with the generator, or brush up on how it compares to the humble barcode.