Glossary Term

QR Code Error Correction

QR code error correction is the redundant data built into every QR code that lets a scanner rebuild the original content when part of the code is damaged, dirty, or covered. It uses Reed-Solomon coding, the same algorithm family used on compact discs and in deep space transmission. Each code carries one of four correction levels (L, M, Q, or H) that decides how much of it can be lost before it stops scanning.

Why QR Code Error Correction Matters

Without redundancy, a single misread module would break the entire payload. A QR code is a fixed binary sequence. Flip one bit and the decoded string becomes garbage, not a slightly wrong URL.

Error correction is the reason a damaged QR code still works. A crease through a flyer, a scuff on packaging, glare across one corner: each destroys modules, and the scanner rebuilds them from redundant codewords.

It also makes branded codes possible. A logo sitting in the centre is destroying data, and the correction budget absorbs it.

Error correction is not optional. Every QR code defined by ISO/IEC 18004 carries it. The only choice is how much.

QR Code Error Correction Levels

Four levels exist. The percentage describes how much encoded data can be recovered, measured in codewords rather than physical area.

Level Recovery capacity Format bits Typical use
L (Low) About 7% 01 Screens, clean environments, long data strings
M (Medium) About 15% 00 General print. The common default
Q (Quartile) About 25% 11 Packaging, labels, anything handled repeatedly
H (High) About 30% 10 Logo overlays, industrial and outdoor use

Denso Wave, where Masahiro Hara invented the format in 1994, recommends level L for clean environments carrying large amounts of data, and Q or H for factory conditions where codes get dirty. Most generators default to M or Q.

The level itself sits in the format information: two bits beside the finder patterns, protected by a BCH code and written into the grid twice, so a scanner still reads the level after one copy is destroyed.

Level H vs Level L

The trade is capacity. Higher correction means more of the grid is spent on redundancy and less on data.

At version 40, the largest standard size at 177×177 modules, level L stores 2,953 bytes. Level H stores 1,273 bytes. That is 57% less data in the same physical grid.

The effect runs the other way too. Hold the data constant and raising the level forces a larger version with more modules. That produces the result which surprises most people: raising error correction can make a small printed code harder to scan. More modules at a fixed print width means each module is physically smaller, and a camera that resolves a level M grid may fail on the denser H version of the same URL. The module math behind minimum print sizes shows how quickly that adds up.

How QR Code Redundancy Works

The data is split into 8-bit codewords. Reed-Solomon coding, published by Irving Reed and Gustave Solomon in 1960, generates extra correction codewords from those data codewords and appends them.

Larger codes split the payload into blocks, give each block its own correction codewords, then interleave everything across the grid. Interleaving is deliberate: a coffee ring that wipes out one region spreads its damage thinly across many blocks instead of destroying one outright.

Version 1, the smallest code at 21×21 modules, holds 26 codewords in total:

Level Data codewords EC codewords Correctable codewords
L 19 7 2
M 16 10 4
Q 13 13 6
H 9 17 8

Correctable capacity is roughly half the correction codewords. The rest is reserved for misdecode protection, which stops the decoder returning a confidently wrong string. Divide the correctable count by 26 and the published percentages appear: 8%, 15%, 23%, 31%.

One nuance matters in practice. Reed-Solomon repairs erasures, where the scanner knows a module is unreadable, at half the cost of errors, where it reads a wrong value. Missing data is cheaper to fix than corrupted data.

What Error Correction Cannot Fix

Correction only protects encoded data. Several failure modes sit outside its reach:

  • Finder patterns. The three large squares in the corners. Damage one and the scanner never locates the code, so the redundancy is never applied.
  • The quiet zone. ISO/IEC 18004 requires four modules of blank margin on all sides. Trimming it in a tight layout breaks codes that are otherwise perfect.
  • Contrast failures. Low contrast, inverted colours, gradients, and glossy varnish stop the camera separating dark modules from light ones. That is an imaging problem, not data loss.
  • Damage past the threshold. Correction has no graceful degradation. One codeword under the limit decodes perfectly, one over it fails completely.

How to Choose an Error Correction Level

  1. Default to M for print. It covers ordinary handling without inflating the grid.
  2. Raise to Q or H for abuse. Packaging, equipment labels, outdoor signage, anything repeatedly handled.
  3. Use H when a logo sits on the code. Keep the overlay under roughly 25% of the code area, never over the finder, timing, or alignment patterns, and test on more than one phone.
  4. Use L only on screens or when the string is too long to fit any other way.
  5. Shorten the URL before raising the version. A long UTM-tagged URL is usually the real cause of a dense grid. Dynamic QR codes encode a short redirect instead, freeing enough room to afford a higher correction level at the same print size.

Frequently Asked Questions

What is error correction in QR codes?

Error correction is redundant data stored alongside the encoded content so a scanner can rebuild the original string when part of the code is unreadable. It uses Reed-Solomon coding and is built into every QR code by the ISO/IEC 18004 standard. The level sets how much damage the code survives.

What is the difference between QR code level H and level L?

Level H protects about 30% of the data against level L’s 7%, so H survives far more damage. The cost is capacity: at version 40, L stores 2,953 bytes and H stores 1,273. Use H for logo overlays and harsh conditions, L for screens or unusually long data.

How does a damaged QR code still work?

Correction codewords generated from the data are interleaved across the grid, so localised damage spreads across many blocks instead of destroying one. When the scanner reads a region as missing or wrong, Reed-Solomon decoding reconstructs the original codewords. This holds up to the level’s threshold, past which the code fails outright rather than partially.

Does a higher error correction level always improve scanning?

No. Higher levels add modules, so at a fixed print width each module gets smaller and harder to resolve. A level H code printed at 2cm can scan worse than the level M version of the same URL. Raise the level and the physical size together, or shorten the encoded URL to pay for it.

To generate trackable QR codes that encode a short redirect instead of a long tagged URL, use the QR code generator at linkutm.