A QR code looks like random noise. It is not — every region has a defined job, the apparent randomness is deliberately manufactured, and with a few rules you can read the version and error correction level of any code by eye. This page explains what each part does and why the design is as good as it is.
The structure in one paragraph
Three corner squares tell the scanner where the code is and which way up. A line of alternating modules gives it a grid to measure against. A ring around the corners stores the error correction level and mask. Everything else is data and Reed-Solomon parity, laid out in a zigzag from the bottom-right — then XORed with a pattern chosen to avoid large blank areas.
The fixed regions
| Region | Where | Job |
|---|---|---|
| Finder patterns | Three corners, 7×7 each | Locate the code and establish orientation |
| Separators | Around each finder | One blank module so the finder is unambiguous |
| Timing patterns | Row 6 and column 6 | Alternating modules that establish the grid |
| Alignment patterns | 5×5 squares, version 2+ | Correct for perspective distortion |
| Format information | Beside the finders | Error correction level and mask, stored twice |
| Version information | Version 7+ | The size, stored twice |
| Quiet zone | 4 modules all round | Blank margin — required, not decorative |
| Data and parity | Everything else | The payload plus Reed-Solomon correction |
Why the finder pattern is that shape
The three corner squares are a concentric arrangement: a 7×7 dark square, a 5×5 light square inside it, a 3×3 dark square inside that. Draw a line through the centre in any direction — horizontal, vertical, or diagonal — and you cross dark and light regions in the ratio 1:1:3:1:1.
That ratio was chosen because it is rare in natural images. A scanner can sweep lines across a video frame at high speed looking only for that proportion, and it will almost never produce a false positive on a photograph, a page of text or a face. This is why QR scanning feels instant while other barcode formats need careful aiming.
Using three corners rather than four is the second piece of the design. Three points define orientation unambiguously — the scanner knows which corner is missing and can therefore work out rotation. A code can be read upside down, at an angle, or in a mirror, and it costs one fewer pattern.
Reading the version
QR versions run from 1 to 40, and each step adds 4 modules per side:
Count the modules along one edge, subtract 17, divide by 4. You now know the version — and therefore roughly how much data it holds. It is the one thing you can read from a QR code without any tools.
Encoding modes
QR codes support four modes, and choosing the right one changes capacity dramatically:
| Mode | Character set | Bits per character | Capacity (v40) |
|---|---|---|---|
| Numeric | 0–9 | 3.33 | 7,089 digits |
| Alphanumeric | 0–9, A–Z, space, $%*+-./: | 5.5 | 4,296 characters |
| Byte | Any 8-bit data | 8 | 2,953 bytes |
| Kanji | Shift-JIS | 13 | 1,817 characters |
Numeric mode packs three digits into ten bits rather than the twelve that four bits each would need. Alphanumeric packs two characters into eleven bits.
✅ Uppercase URLs produce smaller codes
Alphanumeric mode has no lowercase letters, so https://example.com/page must use byte mode at 8 bits per character. Written as HTTPS://EXAMPLE.COM/PAGE it fits alphanumeric mode at 5.5 bits — roughly 30% fewer bits, which often means a smaller version and visibly larger, easier-to-scan modules.
Domain names are case-insensitive so this is safe for the host portion. Paths are not case-insensitive on most servers, so only apply it where you control the URL and know uppercase paths resolve.
Reed-Solomon error correction
This is the part that makes QR codes practical in the physical world, where things get creased, smudged and partially obscured.
| Level | Recovers | Capacity cost | Use for |
|---|---|---|---|
| L (Low) | ~7% | Smallest code | Clean digital display |
| M (Medium) | ~15% | Modest | The usual default |
| Q (Quartile) | ~25% | Noticeable | Print, or a small logo |
| H (High) | ~30% | Largest code | Industrial, or a large logo |
Reed-Solomon works by treating the data as coefficients of a polynomial and adding extra values computed from it. Given enough surviving values, the original polynomial — and therefore the original data — can be reconstructed algebraically. It is the same family of codes used on CDs, in deep-space communication, and in RAID storage.
The important consequence: the correction is distributed across the whole code, not stored in one place. Damage anywhere is recoverable up to the level's limit. This is what allows a logo in the centre — those modules are simply treated as errors.
⚠️ Do not spend the whole error budget on decoration
Level H tolerates about 30% loss, and a logo covering 25% leaves only 5% for real-world damage — a crease, a smudge, a reflection, poor lighting. The code scans perfectly on your screen and fails on a printed flyer that has been in someone's pocket.
Keep decorative coverage under about 15% even at level H, and always test the printed article rather than the design file.
Masking: why it looks random
Here is the step that surprises most people. After the data and parity are placed, the encoder XORs the whole data region with a repeating pattern.
The reason is that raw encoded data often produces awkward results — a large blank area where the data happened to be mostly zeros, or an accidental sequence resembling a finder pattern. Both confuse scanners badly.
So the encoder generates the code eight times, once with each of eight defined mask patterns, and scores each result against four penalty rules:
| Penalty | Penalises | Why it matters |
|---|---|---|
| Rule 1 | Runs of 5+ same-colour modules | Long runs are hard to count accurately |
| Rule 2 | 2×2 blocks of one colour | Solid areas lose grid alignment |
| Rule 3 | Patterns resembling a finder | Causes false detection |
| Rule 4 | Dark/light imbalance | Skews the scanner's brightness threshold |
The lowest-scoring mask wins, and which one was used is recorded in the format information so the decoder can reverse it. The visual noise is therefore engineered: a QR code looks random because randomness is precisely what scans most reliably.
This also answers a common question — two encoders producing visibly different codes for identical text are simply making different mask choices, and both are valid.
How the data is laid out
Data is placed in two-module-wide columns, starting from the bottom-right, moving upward in a zigzag, then down the next pair of columns, alternating direction. Fixed patterns are skipped and the flow continues around them.
The upward-from-bottom-right start is inherited from the original specification and is arbitrary in itself — what matters is that it is deterministic, so any decoder can retrace it.
Micro QR and other variants
| Variant | Difference | Use |
|---|---|---|
| Micro QR | One finder pattern, 11×11 to 17×17 | Small parts, very limited data |
| rMQR | Rectangular | Narrow spaces on packaging |
| Model 1 | The original 1994 design | Obsolete |
| Frame QR | Defined space for artwork | Marketing |
| iQR | Higher density, rectangular option | Industrial; limited support |
Designing codes that actually scan
- Keep the quiet zone. Four modules of blank margin on all sides is part of the specification, not padding. Codes that fail to scan against a busy background are usually missing it.
- Dark on light, always. Scanners expect dark modules on a light background. Inverted codes fail on many readers.
- Maintain contrast. Aim for a ratio of at least 4:1 between module and background. Pale grey on white does not work in real lighting.
- Size for distance. A useful rule is width ≥ distance ÷ 10 — a code read from 2 metres needs to be at least 20 cm across.
- Shorten the URL. Fewer characters means a lower version, which means larger modules at the same physical size.
- Avoid red on white. Some scanners use red illumination, against which red modules have very little contrast.
- Test the real thing — printed, at the actual size, under the lighting where it will be used, on several phones.
💡 Why QR codes won
Denso Wave created the format in 1994 to track car parts, and holds patents on it. They chose to publish the specification openly and have never enforced those patents against implementers.
Competing 2D barcode formats of the era were proprietary and licensed. That single decision is the main reason QR codes are in every phone camera and the alternatives are not — the technology was comparable, and the licensing was not.
Generate or decode a QR code
Create codes with your choice of error correction level, or decode one from an image — entirely in your browser, nothing uploaded.
Open the QR Generator →Summary
- The 1:1:3:1:1 finder ratio is rare in nature, which makes detection fast and reliable.
- Three corners, not four — that asymmetry is what encodes orientation.
- Version = (side modules − 17) ÷ 4. You can read it by counting.
- Uppercase alphanumeric is 30% denser than byte mode.
- Reed-Solomon distributes correction across the code, which is what allows logos.
- Do not spend the whole error budget on decoration — leave room for real damage.
- The random appearance is engineered by masking, and the mask is chosen by scoring.
- The quiet zone is mandatory, and its absence is the most common scanning failure.
Frequently Asked Questions
Why do QR codes have three big squares in the corners?
They are finder patterns, and their ratio of dark to light along any line through the centre is 1:1:3:1:1 — a proportion chosen because it almost never occurs by chance in natural images. A scanner sweeps lines across the frame looking for it. Three corners rather than four is what tells the scanner which way up the code is.
Can a damaged QR code still be read?
Yes. QR codes carry Reed-Solomon error correction at one of four levels, the highest of which recovers from about 30% of the code being unreadable. This is what allows a logo to be placed in the middle — the covered modules are treated as errors and reconstructed.
Why do two QR codes for the same text look different?
Because of masking. After the data is placed, the encoder tries eight different XOR patterns and picks whichever produces the most balanced result, avoiding large blank areas that confuse scanners. Different encoders may choose differently, and the mask used is recorded in the format information.
How much data fits in a QR code?
Version 40 at the lowest error correction holds up to 7,089 digits, 4,296 alphanumeric characters, or 2,953 bytes. In practice, a code that dense needs to be printed large and scanned closely. For real-world use, keeping URLs under about 300 characters keeps the code comfortably scannable.
Are QR codes patented?
The format was created by Denso Wave in 1994 and they hold patents, but they chose to make the specification open and have never exercised those rights against implementers. That decision is the main reason QR codes became universal while competing 2D barcode formats did not.