General

Why QR Codes Still Scan When Half Broken

QR codes survive scratches, logos, and folds thanks to Reed-Solomon error correction. Learn how the four error correction levels work and why this matters for your own projects.

August 2026 4 min read 16 views 0 hearts

Why Your QR Code Still Scans Perfectly When It's Half Broken

You've probably seen a QR code with a little logo stamped in the middle, or maybe one that's been scratched up on a package. You aim your phone at it, and it still works. It feels almost like magic, but the reality is much more clever — and it's built right into the design of QR codes using something called Reed-Solomon error correction.

Most people don't realize that QR codes don't just store your data. They store extra copies of that data in a mathematically efficient way. When you scan a QR code, your phone is doing a little detective work. It's not just reading the black and white squares. It's checking if any of them got damaged, and then using the spare information to rebuild what's missing.

How Error Correction Levels Work

QR codes have four levels of error correction, and the one used depends on who generated the code. The levels are L (Low), M (Medium), Q (High), and H (Highest). Low gives you about 7% recovery, meaning up to 7% of the code can be damaged and it'll still work. Medium is about 15%, High is 25%, and Highest goes up to 30%.

That's why when you see a QR code with a company logo in the center, it's usually using the H level. The logo essentially destroys a chunk of the code, but the error correction patches it up. You can even tear off a corner or scribble over part of it, and it'll still scan if the level is high enough.

There's a catch, though. Higher error correction means you can store less data. A QR code using the H level can hold fewer characters than the same sized code using L. So if someone needs to pack a lot of information into a small space, they might go with L and hope the code stays clean.

The Math Behind the Magic

The technique behind this is called Reed-Solomon encoding. It's a form of error correction that's used in CDs, DVDs, satellite communications, and QR codes. What it does is take your data and treat it like a polynomial — a mathematical equation. Then it adds extra terms to that equation that represent redundant information.

When your phone scans the code, it's essentially solving a system of equations. If some of the squares are missing or wrong, the phone can use the extra terms to figure out what the original polynomial was. It's a bit like if you had a math problem with a few numbers crossed out, but enough information remained to work out the answer anyway.

The beauty is that this works even if you don't know exactly which squares are damaged. The algorithm detects errors, figures out where they are, and corrects them all in one go. That's why QR codes can handle not just random scratches but also systematic damage like a logo or a fold.

Why This Matters for Your Projects

If you're generating QR codes yourself, understanding error correction can save you from frustration. For example, let's say you're creating QR codes for product labels that will be printed on cardboard. Cardboard scuffs easily, so you'd want to use at least M or Q level. But if you're putting a QR code on a phone screen, which is clean and well-lit, L is fine.

At PythonSkillset.com, we've seen developers generate QR codes for inventory tracking without realizing that the codes would be scanned in dusty warehouses under harsh lighting. They used the default error correction, which is often M, and ran into failures when labels got smudged. Switching to Q solved the problem, even though it meant storing slightly less data per code.

Another common use is in marketing materials. If you're placing a QR code near a fold in a brochure, use H. The fold will corrupt some of the squares, but as long as it doesn't cover more than 30% of the code, you're fine. And if you're adding a logo or a custom design, always go with H.

Real-World Tricks

Some clever implementations take advantage of error correction in ways you might not expect. For example, animated QR codes that change color along a gradient work because the error correction handles the missing contrast in the lighter areas. Or QR codes printed on curved surfaces like soda cans — the distortion is corrected by the error correction if the level is high enough.

There's also a technique called "QR code art" where people intentionally replace large portions of the code with images. The error correction fills in the gaps. As long as the image doesn't cover more than the level allows, it scans perfectly. Some companies use this to embed their logo or a small sketch into the code, making it more visually appealing.

The Bottom Line

QR codes seem simple, but they use some genuinely clever math to be resilient. Next time you scan a beat-up code on a package or one with a logo in the middle, remember it's not luck. It's error correction doing its job, quietly making sure your link or payment goes through even when things aren't perfect.

For anyone building with QR codes, the lesson is simple: choose your error correction level based on where and how the code will be used. It's a small decision that makes a big difference in reliability. And if you're ever debugging a QR code that won't scan, check the damage against the level — it might be that you just need to bump it up a notch.

Comments

Questions, corrections, and tips stay visible for everyone reading this page.

0 in thread

Join the discussion

Shown next to your comment.

Up to 4,000 characters

No comments yet

Be the first to leave a note — it helps the next reader.