Contents
In short: a QR code doesn't store just its message. It adds spare bytes computed from it, Reed–Solomon error correction, the same maths used on music CDs, so a reader can rebuild bytes that are missing or wrong. You choose how many: four levels, L, M, Q and H, restore about 7, 15, 25 and 30% of the codewords, and more spare bytes make a bigger code. That's why a logo in the middle can work: to the reader it's damage. The three corner squares are different: they aren't data, they let the reader find and straighten the code, so most readers need them.
Torn, stained, still scans
DENSO WAVE, which developed the QR Code: "QR Code has error correction capability to restore data if the code is dirty or damaged." And in its list of features: "Data can be restored even if the symbol is partially dirty or damaged."
The code in the video is real: it says oliverz.dev. Torn at a corner, stained at the edge and covered by a logo in the middle, 13 of its 44 codewords are wrong, and it still decodes (we tested it with two decoders, jsQR and ZXing).
Spare bytes, computed from the message
DENSO WAVE: "The QR Code error correction feature is implemented by adding a Reed-Solomon Code… to the original data." The University of Canterbury's Computer Science Field Guide puts it simply: "it adds extra bits to the data so that errors can be corrected."
The unit is the codeword. DENSO WAVE: "codeword is a unit that constructs the data area. One codeword of QR Code is equal to 8 bits." And the CS Field Guide: "Each black or white square (“dot” or “module”) corresponds to one bit of data." So eight modules make one byte.
The maths isn't new. DENSO WAVE: "Reed-Solomon Code is a mathematical error correction method used for music CDs etc. The technology was originally developed as a measure against communication noise for artificial satellites and planetary probes."
Two spare bytes for every byte fixed
DENSO WAVE: "Reed-Solomon Code requires twice the amount of codewords to be corrected." The CS Field Guide: "The maximum number of errors that a Reed-Solomon code can correct is one half of the amount of extra error correcting data added to it."
Our code, at the highest level, has 16 message codewords and 28 spare ones, 44 in all. Half of 28 is 14, so it can fix up to 14 wrong codewords: 14 of 44 is about 32% (our arithmetic), DENSO's "Approx. 30%". In our test the limit held exactly there: 14 wrong codewords still read, 15 gave no result.
No result, not a wrong one. The CS Field Guide: "they won’t read the data incorrectly, instead they just refuse to give any data at all, rather than giving you incorrect data."
Four levels: 7% to 30%
From DENSO WAVE's outline of the standard (ISO/IEC 18004): "Level L Level M Level Q Level H Approx. 7% of codewords can be restored. Approx. 15% of codewords can be restored. Approx. 25% of codewords can be restored. Approx. 30% of codewords can be restored."
The percentage counts codewords, not the area you can see: "*Data restoration rate for total codewords" … "QR Code therefore represents its error correction rate as a ratio of the total codewords."
More spare bytes cost space. DENSO WAVE: "Raising this level improves error correction capability but also increases the amount of data QR Code size." And: "as the amount of data increases, more modules are required to comprise QR Code, resulting in larger QR Code symbols." Our four codes of oliverz.dev, message + spare codewords:
- L: 19 + 7, 21 × 21 modules
- M: 16 + 10, 21 × 21 modules
- Q: 13 + 13, 21 × 21 modules
- H: 16 + 28, 25 × 25 modules (at H, the 11 bytes of "oliverz.dev" no longer fit in 21 × 21)
A logo is damage it repairs
So a logo in the middle can work: the reader treats it as damage and rebuilds what it hides. On our H code, a logo of 7 × 7 modules makes 9 of its 44 codewords wrong, within its limit of 14.
It isn't free, though: it spends the spare bytes. DENSO WAVE's FAQ, on codes with colours or an inserted illustration: "If it is deformed, the QR Code's error correction function is invoked where even a tiny missing or smeared part renders the reading operation impossible, or the response of the operation may become slow."
Don't cover the corners
The three big squares aren't data. DENSO WAVE: "QR Code accomplishes this task through position detection patterns located at the three corners of the symbol." Its history of the code: with them, "the orientation of their code could be determined regardless of the angle of scanning, which could be any angle out of 360°".
The CS Field Guide: "Don’t colour in near the three large squares in the corners, as most QR scanners need these to align the image."
In our test, a small sticker of 3 × 3 modules on the centre of one corner square stopped both decoders, with no data byte touched. The logo covers 49 modules and scans; the sticker covers 9 and doesn't.
Takeaway
- A QR code stores its message plus spare bytes made from it (Reed–Solomon), so a reader rebuilds bytes that are torn, stained or covered.
- You choose how many: L, M, Q, H, about 7 to 30% of the codewords; more spare bytes, a bigger code. A logo in the middle is damage the spare bytes cover.
- The three corner squares aren't data: they let the reader find and straighten the code, so most readers need them.
Sources
- DENSO WAVE: Error Correction Feature, QR Code Standardization, What is a QR Code?, Information capacity and versions of the QR Code, History of QR Code, FAQ
- University of Canterbury, Computer Science Field Guide, QR codes
The video is animated with code and the script was written with AI assistance; every quote above is checked against its source, and the figure marked "our arithmetic" is ours. The codes are real (generated, then decoded with jsQR and ZXing), and so are their bytes and codeword counts. Illustrative: the tear, the stain and the logo (a generic mark, drawn on exactly the modules we tested), the camera viewfinder, and the tilted code, which is the same code drawn in perspective. Real wear is less tidy than damage drawn along the modules. "QR Code" is a registered trademark of DENSO WAVE INCORPORATED. The video is narrated in English. Made with Shotloop, my free Mac app for code-made explainers, fixed one shot at a time.






