Skip to content
Tech October 8, 2023 5 min read

How QR Codes Actually Work (And Why They Survive Being Damaged)

You scan them every day at restaurants, parking meters, and event tickets. But QR codes contain some genuinely brilliant engineering that most people never notice.

A QR code is not just a random collection of black and white squares. Every element is deliberately placed according to a mathematical framework that allows any smartphone camera to instantly find, orient, and decode the information — even if part of the code is damaged, dirty, or obscured. The engineering behind this everyday technology is more sophisticated than most people realize.

How a Camera Finds and Reads a QR Code

The three large squares in the corners (called finder patterns) are why your phone can instantly locate a QR code in a photo. These squares have a unique ratio of black-white-black-white-black (1:1:3:1:1) that does not appear naturally in everyday images. Your phone's camera scans the image looking for this specific ratio pattern. Once it finds all three corners, it knows the exact position, size, and rotation of the code — which is why QR codes work at any angle, distance, or orientation.

The smaller square patterns (alignment patterns) correct for perspective distortion. If you scan a QR code at an angle, the alignment patterns let the software mathematically transform the skewed image back into a perfect square before reading the data. This is why you can scan a QR code on a curved surface, from across a table, or while walking past a poster — the math compensates for imperfect viewing conditions.

Error Correction: The Genius Part

QR codes use Reed-Solomon error correction, the same algorithm used in CDs, DVDs, and deep-space communication. The data is encoded with redundancy — depending on the error correction level, 7% to 30% of the QR code can be damaged or missing and the full data still recovers perfectly. This is why QR codes with logos in the center still work: the logo destroys up to 30% of the code, but the error correction rebuilds the missing information from the remaining 70%.

The four error correction levels are L (7% recovery), M (15%), Q (25%), and H (30%). Most QR codes use M or Q. Higher correction means larger codes (more squares needed for redundancy), which is why codes with logos embedded tend to be physically larger — they need level H correction to compensate for the logo destroying data modules.

Making Your Own

Generate QR codes for URLs, WiFi passwords, email addresses, phone numbers, and plain text with our QR code generator. Every code generated uses M-level error correction and downloads as a PNG image ready for print or digital use.

🐛 Report a Calculator Error
Found a bug or outdated data? Reports go directly to Kevin and are reviewed personally.