Finder patterns
Three 7-by-7 targets identify the symbol and its rotation. A one-module light separator isolates each target from nearby modules.
Inside the matrix
A QR Code is not a square of arbitrary pixels. Fixed landmarks orient the scanner; metadata explains how to decode it; a zigzag stream carries segment headers, payload, padding and Reed-Solomon recovery data.
01 / Anatomy
Functional patterns are reserved before the encoded stream is placed. They are not payload bytes, and the data traversal steps around them.
Three 7-by-7 targets identify the symbol and its rotation. A one-module light separator isolates each target from nearby modules.
Version 2 and higher add smaller 5-by-5 targets. Their number grows with the version so a reader can correct perspective and surface distortion.
Alternating dark and light modules on row 6 and column 6 establish the module rhythm and connect the finder regions.
One fixed dark module sits at row 4V + 9, column 8. It is always on and is separate from the nearby format copy.
03 / Encoded stream
Automatic segmentation can switch modes when the reduced payload size is worth another mode and count header. Every segment starts with its own mode and character-count fields.
The 4-bit mode indicator selects Numeric, Alphanumeric, Byte or Kanji. Count-field width depends on both mode and version range; Byte mode counts encoded bytes.
Each example below is a complete Version 1 segment header and payload. The count field changes width by mode; Byte counts encoded bytes rather than visible characters.
1233 digits0001
Count
Payload
AB2 characters0010
Count
Payload
é2 UTF-8 bytes0100
Count
Payload
漢1 character1000
Count
Payload
1234567890HELLO-worldEach colored block is a separate segment with another 4-bit mode indicator and count field. The optimizer keeps a switch only when its smaller payload offsets that header cost. Automatic detection does not select Kanji; Kanji must be requested explicitly.
After the last segment, up to four zero terminator bits are added. More zero bits reach a byte boundary; alternating 0xEC and 0x11 pad codewords fill the data capacity.
Some versions leave 3, 4 or 7 traversable modules after all complete codewords. These zero remainder bits complete the matrix geometry; they are not data or error correction.
04 / Recovery and placement
Error correction does not simply occupy a rectangular corner. Data and recovery codewords follow the same two-column zigzag placement path after block interleaving.
The selected version and recovery level define one or more Reed-Solomon blocks over GF(256). Data and EC codewords are interleaved across blocks before placement, spreading localized damage across recoverable symbols.
One of eight formulas flips selected non-functional modules. The encoder scores all candidates for long runs, 2-by-2 blocks, finder-like patterns and dark/light balance, then records the winner in format information.
Eight mask candidates
For every non-functional module at row r and column c, a true formula flips the stored bit. Blue shows where each formula is active. Finder, alignment and timing patterns remain as dark reference landmarks because masking never changes them.
(r + c) mod 2 = 0r mod 2 = 0c mod 3 = 0(r + c) mod 3 = 0(floor(r / 2) + floor(c / 3)) mod 2 = 0(r x c) mod 2 + (r x c) mod 3 = 0(((r x c) mod 2) + ((r x c) mod 3)) mod 2 = 0(((r + c) mod 2) + ((r x c) mod 3)) mod 2 = 005 / Decoder order
Use finder, separator, timing and alignment patterns to estimate the module grid.
Decode format information, select the EC level and mask, and read version information when present.
Reverse the selected mask on non-functional modules and collect codeword bits along the two-column zigzag path.
Reconstruct Reed-Solomon blocks, detect errors and recover codewords where redundancy permits.
Read each mode and count header, then decode its payload units until the terminator or data capacity is reached.
Primary references
This guide is explanatory, not a substitute for the normative standard. Exact block tables, count widths, mask penalties and encoding rules are implemented by the generator and tested against reference matrices.