# The Code That Expects Dirt

A QR code keeps three anchors for orientation and adds recovery data for errors. Turn it, stain it, and see what remains readable.

## Three squares tell a scanner where the code is

A scanner has to find the code and read its angle. The three position patterns sit in the corners. Their width ratio is 1:1:3:1:1, a rare signature in printed material.

## A QR code pre-pays for some of its mistakes

When you generate it, you choose how much space to allocate to recovery data. The code uses Reed–Solomon, a method that corrects errors at byte level. More reserve means less room for the message at the same code version.

| Level | Recovery |
| --- | --- |
| L | approx. 7% of total codewords |
| M | approx. 15% of total codewords |
| Q | approx. 25% of total codewords |
| H | approx. 30% of total codewords |

## Erased area is not the only measure of loss

Move the slider and change the damage shape. A compact stain and a scratch across the code can cover the same area while touching different byte groups. The model turns that distinction into a visual intuition; a real phone also depends on contrast, size, distance, and printing.

## Every square carries two instructions

The first carries a message. The second helps a scanner find that message and recover part of it when the ink gets dirty. The result is a small object built for an imperfect world.

## What is documented and what is a model

This page uses the format’s official documentation and a visual reconstruction to make the mechanism easy to see.

- [QR Code Standardization · DENSO WAVE](https://www.qrcode.com/en/about/standards.html): symbol dimensions, the four recovery levels, and ISO standardization
- [Error Correction Feature · DENSO WAVE](https://www.qrcode.com/en/about/error_correction.html): Reed–Solomon, 8-bit codewords, and recovery as a share of total codewords
- [QR Code development story · DENSO WAVE](https://www.denso-wave.com/en/technology/vol1.html): the three position patterns, the 1:1:3:1:1 ratio, and resistance to dirt or missing areas
- [ISO/IEC 18004:2024 · ISO](https://www.iso.org/standard/83389.html): the international specification for the symbol, encoding, error correction, and decoding algorithm

The damage state is a teaching model. It keeps the matrix of a real QR code and makes the idea of reserve visible; it does not replace a scan test under controlled conditions.

Status: evergreen, periodically reviewed. Review is triggered by a material change to ISO/IEC 18004 or the official definitions of recovery levels.

Evidence checked on 12 August 2026.

— Designed and edited by Marius Comper
