Spec & internals
Format information: the 15 bits everything depends on
Format information is 15 bits: 2 for the error-correction level, 3 for the mask pattern, and 10 BCH(15,5) check bits, all XORed with the fixed mask 101010000010010. It is written twice beside the finder patterns, because a decoder can read nothing else until it has decoded these bits.
What the 15 bits say
Format information carries the two settings a decoder must know before touching the data region:
| Bits | Content |
|---|---|
| 2 | Error-correction level: L = 01, M = 00, Q = 11, H = 10 |
| 3 | Mask pattern number, 000–111 |
| 10 | BCH(15,5) error-correction bits over the 5 data bits |
Note the level encoding is not in strength order: M is 00, below L's 01. It is a spec
quirk worth knowing when reading raw bits.
The full 15-bit word is then XORed with the fixed mask 101010000010010, which
guarantees the format region is never all light (an all-zero format would otherwise render
as blank background and be undetectable).
Worked example: level M, mask 5: data bits 00101, BCH-coded to 001010011011100,
XORed to 100000011001110. Those are the exact modules written into the symbol.
Where it lives
The word is written twice:
- Copy 1 wraps the top-left finder pattern, along row 8 and column 8.
- Copy 2 is split: part under the top-right finder, part beside the bottom-left one.
One extra module (the dark module at row 4 × version + 9, column 8) sits permanently dark next to the second copy. It carries no information; it is a fixed feature of the symbol's anatomy.
Why it is the most protected data in the symbol
Every other bit in a QR code is recoverable through Reed–Solomon: if the decoder knows which mask to remove and which block structure to expect. Both facts live in the format information. Corrupt them and the decoder unmasks with the wrong pattern and de-interleaves with the wrong geometry: the payload becomes unrecoverable even when every data module is intact. So the standard defends these 15 bits three ways:
- BCH(15,5), 10 check bits for 5 data bits, able to correct up to 3 bit errors per copy. That is a far higher redundancy ratio than the data region gets at any level.
- Two complete copies in different parts of the symbol, so localised damage rarely takes both.
- A brute-forceable space. There are only 32 valid format words; a desperate decoder can compare a damaged read against all of them and pick the nearest, which is exactly what most implementations do.
What this means for styling
The format regions hug the finder patterns, precisely where frames and labels and oversized custom eyes tend to encroach. A styled code that repaints row 8 or column 8, or lets a logo drift toward a corner, is spending its most expensive bits first. Damage simulations bear this out: flipping a handful of modules beside two finders can kill a code that would have survived 25% damage in the data region. Keep effects away from the finder surrounds, and verify the rendered code decodes after any styling.
FAQ
What is format information in a QR code?
Fifteen bits beside the finder patterns recording the error-correction level (2 bits) and mask pattern (3 bits), protected by 10 BCH check bits and XORed with the fixed mask 101010000010010. It is stored twice for redundancy.
Why is format information stored twice?
Because nothing else in the symbol can be decoded without it. Two copies in different locations mean localised damage (a scratch near one finder) rarely destroys both, and the BCH code can repair up to 3 bit errors in each copy.
What is the single black square that is always in the same place?
The dark module, at row 4×version+9, column 8, beside the bottom-left finder. It is always dark, carries no data, and is simply a fixed structural feature defined by the standard.
What happens if format bits are damaged?
The decoder tries BCH correction (up to 3 bit errors), falls back to the second copy, and as a last resort compares against all 32 valid format words. If all of that fails, the code is unreadable even when the data region is perfect.
Try it: free, no signup
Related
- QR code anatomy: every region of the symbol, A labelled tour of a QR code: finder patterns, separators, timing, alignment, format and version information, the data region and the quiet zone.
- Version information: how big symbols declare their size, From version 7 up, QR codes carry an 18-bit BCH(18,6)-protected version field, written twice near the finders, so decoders need not trust module counting.
- Mask patterns 0 to 7: the eight formulas and why they exist, Every QR code XORs its data region with one of eight fixed patterns to break up problem shapes. The formulas, what they look like, and what masking prevents.
- QR code error correction levels explained, L, M, Q and H tolerate roughly 7%, 15%, 25% and 30% damage. Higher levels cost capacity, so the same payload needs a bigger version, which means smaller…