Full demo
Make a QR code, damage it, and see whether it can still be read. Each step a scanner takes is shown with its result, and links to the chapter that explains it.
Byte mode, version 4-M, mask 110: 33 × 33 modules.
Click or tap modules to flip them, or drag across the code with a mouse. Only the parts a scanner decodes can be damaged: the data area and the format and version information.
No damage yet.
corrected not corrected
How a scanner reads it
Read correctly. Damage the code to see how much it can take.
✓ Format information Chapter 2
The copy around the top-left finder pattern matches level M, mask 110 exactly.
✓ Version Chapter 1
33 × 33 modules: version 4. Up to version 6, the size is enough.
✓ Bytes Chapter 6
Undo mask 110 and read the 100 bytes along the zigzag, leaving out the 7 remainder bits. None of them are damaged.
✓ Error correction Chapter 5
Sort the bytes back into their 2 blocks, with 18 error correction bytes each. A block can correct up to 9 damaged bytes.
Block Bytes Damaged Result 1 32 + 18 0 No errors 2 32 + 18 0 No errors Bytes are data + error correction. “Damaged” counts the bytes that differ from those sent; the scanner can't see this, only the result.
✓ Text Chapter 3
Byte mode, 56 bytes:
QR codes can still be read when part of them is damaged.
The same text that was encoded.
Things to tryLink to this section
- Flip modules one at a time in one corner of the data area, and watch the damaged bytes add up until a block fails. Then try the same at level H.
- Damage the format information around the top-left finder pattern. With more than 3 bits wrong, the scanner reads the other copy instead (chapter 2).
- Type a longer text, so the code has several blocks, and add a blot. Interleaving shares its bytes out among the blocks (chapter 5).
- Cause a misread damages a block so that it lies closer to the block for a slightly different text, and the decoder corrects it to that one (chapter 5). The scanner returns the wrong text without noticing.
- Turn off the marks and point your phone's camera at the screen. Scanners differ in the details, and a camera adds its own problems, so a real one won't always agree.
What the demo leaves outLink to this section
A real scanner starts with a photo. It finds the three finder patterns, works out the grid of modules from them and the timing and alignment patterns, and decides whether each module is dark or light (section 12). This demo starts from the grid itself, so those patterns can't be damaged here.
The demo also treats every damaged byte as an error. A scanner that knows some modules are unreadable, say under a smudge, could treat their bytes as erasures and correct up to twice as many of them.