A QR code looks like a random square, but every pixel has a function. This guide opens the QR from the inside: what each part is, how information is encoded, why it tolerates so much damage, and what technical decisions Denso Wave took in 1994 that still hold 30 years later.
Quick answer
- A QR is a square matrix of modules (black and white pixels). Size ranges from 21×21 (version 1) to 177×177 (version 40).
- Has fixed functional zones (the three corner squares, alignment pattern, timing line) and data zones.
- Data is encoded with Reed-Solomon, the same algorithm as CDs and satellites, allowing reconstruction if part of the QR is damaged.
- Before printing, the QR goes through a mask (one of 8 predefined patterns) preventing large uniform zones that confuse the reader.
- Maximum capacity of a QR version 40 with low ECL: ~4,296 alphanumeric or ~7,089 numeric characters.
QR anatomy
A QR is like a printed microchip. Its parts:
1. Positioning patterns (the three "eyes")
Three large squares at corners (except bottom-right). They're orientation markers: the reader detects them first, calculates QR rotation and scale, then reads the rest.
That's why if you cover or damage one of these three "eyes", no correction level saves it: the reader doesn't know where the QR is.
2. Alignment patterns
Smaller squares distributed in the QR body (only appear in version 2+, i.e. larger than 21×21). They let the reader compensate for distortion: wrinkled paper, photo at angle, bad lens.
The higher the version (larger QR), the more alignment patterns.
3. Timing line
A row of alternating black/white modules connecting the "eyes". Lets the reader calculate each module's exact size when the QR is deformed or photographed in perspective.
4. Format and version information zones
Small regions near the "eyes" encoding:
- ECL level (L, M, Q, or H — see QR error correction levels).
- Applied mask (which of the 8 mask patterns was used).
- QR version (in QR version 7+).
5. Data zone (the rest)
Everything else, filling from bottom-right corner upward in zigzag, is encoded information plus Reed-Solomon redundant bytes.
6. Quiet zone
The white margin around the QR. Not optional: standard requires at least 4 modules wide. If you stick the QR against a flyer edge without margin, it'll fail on many readers. Full coverage: How to add a QR to an image.
QR versions
The standard defines 40 versions, from 1 (21×21 modules) to 40 (177×177).
| Version | Modules | Typical URL capacity (M) |
|---|---|---|
| 1 | 21×21 | ~17 characters |
| 3 | 29×29 | ~42 characters |
| 5 | 37×37 | ~84 characters |
| 10 | 57×57 | ~213 characters |
| 20 | 97×97 | ~666 characters |
| 40 | 177×177 | ~2,331 characters |
Same content can be encoded in different versions (with "padding"). But using the smallest possible version is recommended: fewer modules = easier to read.
So, if your URL is very long (https://yourcompany.com/promo/?utm_source=instagram&utm_medium=story&utm_campaign=summer2026), the resulting QR needs a high version and will be dense. Shorten it with a short domain or minimize parameters. More on this: Static vs Dynamic QR.
How information is encoded
QR supports four encoding modes, each more efficient for its data type:
- Numeric (0-9): 10 bits per 3 digits. Most compact.
- *Alphanumeric (0-9, A-Z, space, symbols `$%+-./:`)**: 11 bits per 2 characters.
- Byte (UTF-8 / Latin-1): 8 bits per character. Most flexible (accepts any text).
- Kanji (Japanese characters): 13 bits per character. For something — QR is Japanese.
A good encoder picks the most efficient mode for your content automatically. Typical URLs use alphanumeric or byte depending on characters.
Step-by-step example
Let's encode HELLO in alphanumeric mode:
- Each character converts to its index in the alphanumeric table:
- H = 17, E = 14, L = 21, L = 21, O = 24.
- Group by pairs: (17, 14), (21, 21), (24).
- Each pair combined as
45 × first + second:- (17, 14) → 17×45 + 14 = 779.
- (21, 21) → 21×45 + 21 = 966.
- (24) → a single character, encoded with 6 bits = 011000.
- Numbers translated to 11-bit binary each:
- 779 →
01100001011 - 966 →
01111000110 - 24 →
011000
- 779 →
- Headers prepended: mode (4 bits) and length (9 bits for alphanumeric up to version 9).
- Padded to fill the chosen version's capacity.
- Reed-Solomon applied to add redundant bytes.
- Everything distributed in the data zone in zigzag.
The result is a bit block the reader decodes in reverse.
The mask trick
If we drew bits directly, certain content would produce large uniform zones (all black or all white) confusing the detector. To avoid this, the QR applies a mask: a geometric pattern XORed with data.
There are 8 predefined masks (numbered 0-7). The encoder tries all 8 and picks the one with the "most readable" pattern based on scoring:
- How many uniform blocks exist.
- How many patterns similar to positioning ones could be confused.
- How many rows/columns have many same modules in a row.
- Balance between dark and light modules.
The chosen mask is recorded in the format zone, so the reader knows which one to apply in reverse to recover original data.
Visual implication: two QR with same content can look very different if the encoder picked different masks (or the scoring algorithm differs between generators).
Reed-Solomon: how damage is reconstructed
Reed-Solomon is an error-correction algorithm published in 1960. The idea:
- Take N bytes of data.
- Add K redundant bytes calculated from the N originals.
- If you lose up to K/2 bytes, you can reconstruct them with the rest.
In QR:
| ECL Level | % redundant bytes | Max recoverable damage |
|---|---|---|
| L | ~7% | up to 7% |
| M | ~15% | up to 15% |
| Q | ~25% | up to 25% |
| H | ~30% | up to 30% |
If dirt, logo, or tear exceeds that percentage, the QR fails. Error correction isn't magic: there's a hard limit.
More practical detail on when to use each level: QR error correction explained.
Why the three "eyes" aren't symmetric
Notice: there are three "eyes" — top-left, top-right, bottom-left. No eye at bottom-right. Why?
It's deliberate. That asymmetry lets the reader determine QR rotation. If all four were equal, you couldn't tell if the QR is upright or upside-down. With three eyes in an "L", only one rotation is possible.
And colorful QR codes?
The QR standard defines one color for dark modules and another for light. The spec talks "dark" and "light", not "black" and "white". So:
- You can use any color for modules as long as contrast with background is ≥ 3:1 (WCAG recommends ≥ 4.5:1).
- Gradients work if minimum contrast at any gradient point exceeds that threshold.
- Inverting colors (light modules, dark background) works on modern readers, but 15-20% of older phones fail.
To add your brand with corporate colors: Complete QR with logo and colors tutorial.
Microversions and rMQR
Two formats derived from standard QR:
Micro QR
Much smaller QR (11×11 to 17×17 modules). Limited capacity (~35 alphanumeric characters), but useful when space is critical (jewelry, small electronic components).
Has only one "eye" in top-left. Supported by specialized readers, not always by phone native camera.
rMQR (rectangular)
Approved 2022. It's a rectangular (not square) QR, useful for elongated spaces (ribbons, narrow tags). Capacity similar to standard QR for equal area.
QRcito generates standard square QR version 1-40, which is what mobile readers understand by default.
The standard and its history
- 1994: Denso Wave (Toyota subsidiary) invents QR for automotive parts traceability.
- 2000: ISO/IEC 18004:2000, formal international standard.
- 2005: Reaches Japanese mobile telephony (Sharp flip phones included QR readers from factory).
- 2010-2015: Explosion in China and India (Alipay, WeChat Pay).
- 2017: Apple integrates the reader into iPhone's native camera. Massive Western adoption.
- 2020: COVID skyrockets usage (digital menus in restaurants, health certificates).
- 2024+: Standardized QR payments, plane tickets, digital ID, health, logistics.
Denso Wave holds the patent but waived royalties. That's what enabled mass adoption: anyone can generate and read QR without paying licenses.
Some curiosities
- The biggest official QR measured 22,000 m² in China (2020), a plant field forming a QR.
- The smallest functional QR is made by Denso Wave at 0.9 mm × 0.9 mm for industrial parts.
- Some QR have "easter eggs": leaving certain bits "free" after padding, hidden messages can be inserted for humans seen only with specialized software.
- First QR scanned in space: 2009, ISS, on a component label.
- Why the pattern looks "random": because the mask optimizes appearance. Without mask, many QR would have obvious parallel stripes or uniform blocks.
For programmers: recommended libraries
If you want to generate QR in code:
- JavaScript:
qrcode,qr-code-styling(used by QRcito),node-qrcode. - Python:
qrcode,segno,python-qrcode-extended. - Java/Android:
ZXing(the reference). - Swift/iOS:
CoreImagewith built-inCIQRCodeGeneratorfilter. - Go:
github.com/skip2/go-qrcode. - Rust:
qrcodecrate.
All implement the ISO/IEC 18004 standard and are free.
Frequently asked questions
Is there an "infinite" QR or something? No. Maximum version is 40 (177×177 modules) with ~7000 numeric or ~4300 alphanumeric characters. Beyond that, other formats (PDF417, Data Matrix, Aztec).
Can there be two QR with same content and different visual pattern? Yes. The encoder can pick different mask (8 options), different mode (alphanumeric vs byte), and different ECL level. For the reader, all three are valid.
Can "malicious code" be injected in a QR? The QR is just text. It doesn't execute code by itself. The risk is where it directs you (a malicious URL, a WiFi command to a trap network). More: Quishing, QR scams.
Why do some QR have a small square in the bottom-right corner? It's the alignment pattern nearest the bottom-right zone. Automatically appears in version 2+ QR. Helps the reader compensate distortion in zones far from the three main "eyes".
Why is a QR faster to read than a barcode? Because the QR encodes in 2 dimensions (horizontal + vertical), while a linear barcode does only one. The phone camera sees the three QR "eyes" and orients itself immediately, without needing to sweep in one specific direction.
In short
A QR isn't a random square: it's a microformat with precise anatomy, mathematical encoding, and calculated damage tolerance. Knowing how it works inside helps you make better decisions when generating it: right ECL level, minimum physical size, logo position. Good news: QRcito makes all these decisions for you automatically, unless you want to tune them.
Create your ISO/IEC 18004 standard QR in seconds: qrcito.com