QR Code Error Correction Explained
QR codes can survive scratches, smudges, partial coverage from a logo, and years of weathering on outdoor signage — and still decode in milliseconds. The mechanism behind that resilience is Reed-Solomon error correction, one of the most elegant algorithms in everyday engineering.
How Reed-Solomon error correction works
Before a QR encoder places a single module on the grid, it divides your data into fixed-size chunks called codewords (each codeword is 8 bits). It then computes additional codewords — error correction codewords — using polynomial arithmetic over a Galois field. The data codewords and error correction codewords are interleaved and written together into the module grid.
When a scanner reads a damaged QR code, some codewords may be unreadable (an erasure) or may contain wrong values (an error). The Reed-Solomon decoder uses the relationship between the surviving codewords and the error correction codewords to reconstruct whatever is missing — similar to solving a system of equations where some unknowns are missing but you have extra constraints that let you fill them in.
The key property: if the number of corrupted codewords does not exceed the error correction capacity, the original data is always recoverable, regardless of which codewords were damaged. This is not probabilistic — it is mathematically guaranteed.
Reed-Solomon is the same algorithm used in CDs, DVDs, Blu-ray discs, RAID storage, and the deep-space communication systems that transmitted images from the Voyager probes. Its application in QR codes is one of the reasons a crumpled or partly torn code can still scan.
The four error correction levels
The QR standard defines four error correction levels, each specifying what percentage of the total codewords are devoted to error correction rather than data. Higher levels mean more redundancy — and therefore more damage recovery — at the cost of reduced data capacity.
Roughly 7% of codewords are error correction. Maximizes data capacity. Use when the code will be printed cleanly and displayed in good conditions — digital screens, high-quality offset printing, indoor signage with no weather exposure.
Roughly 15% of codewords are error correction. The standard default for most QR generators. A good balance between capacity and resilience for everyday uses: business cards, brochures, product packaging, restaurant menus.
Roughly 25% of codewords are error correction. Suitable for industrial environments, outdoor signage, or any print context where the code may accumulate surface wear. Also appropriate for codes printed on textured or absorbent substrates where ink spread reduces effective contrast.
Roughly 30% of codewords are error correction. Required for any QR code that will carry an embedded logo. The logo intentionally obscures part of the code; level H is the margin that lets the scanner reconstruct what the logo hides. See the logo section below and our logo best practices guide.
The version and capacity tradeoff
Choosing a higher error correction level does not simply reduce capacity at a fixed code size — it often forces the encoder to use a larger version (a bigger grid) to fit the same data. Understanding this tradeoff is important when you need to balance code size with reliability.
Consider encoding the string https://qronimo.app (20 bytes) at each error correction level:
- Level L — fits in version 1 (21×21 modules, the smallest possible QR code)
- Level M — fits in version 1 (same string, same size)
- Level Q — requires version 2 (25×25 modules)
- Level H — requires version 2 (25×25 modules)
For short content the difference is one version step. For longer content — a full URL with query parameters, a vCard, a Wi-Fi password — the jump from L to H can mean several version steps, resulting in a noticeably denser and larger code.
There is a counterintuitive implication: a version 7-L code can hold more bytes than a version 5-H code, even though version 7 is larger, because the H level devotes so much space to redundancy. When scanning conditions are reliable (a clean digital display, a freshly printed label), choosing L and a smaller code is often the better engineering decision.
A concrete example: encoding a URL
The table below shows the actual version (grid size) required to encode https://qronimo.app at each error correction level, along with the maximum data capacity at that version.
| ECC Level | Version needed | Grid size | Max bytes at this version | Bytes remaining after URL |
|---|---|---|---|---|
| L | 1 | 21 × 21 | 41 | 21 |
| M | 1 | 21 × 21 | 25 | 5 |
| Q | 2 | 25 × 25 | 20 | 0 |
| H | 2 | 25 × 25 | 17 | 0 (tight fit) |
Which level should you choose?
The right level depends on two factors: how reliably the code will be printed and displayed, and whether you are adding a logo.
- Choose L when
- The code will be displayed on a screen or printed at high quality on clean, flat stock. You want the smallest possible code size. There is no logo. Examples: digital menu boards, email signatures, website landing page codes.
- Choose M when
- You want a sensible default that handles minor scratches, fingerprints, and slight print imperfections. Most use cases that do not involve logos or outdoor display fall here. Examples: business cards, brochures, product packaging, event tickets.
- Choose Q when
- The code will be exposed to wear, weather, or difficult print substrates. Examples: outdoor posters (laminated), labels on physical products that will be handled repeatedly, codes printed on textured cardstock or fabric.
- Choose H when
- You are embedding a logo inside the QR code. No other level provides enough redundancy for reliable logo scanning. Also choose H for codes in very high-wear environments: stickers on equipment, outdoor signage without lamination, or anywhere the code surface may be partially obscured or abraded.
Logo embedding and error correction
Placing a logo in the center of a QR code is the most common reason to use error correction level H. The logo physically covers data modules, making them unreadable — which is exactly what error correction exists to handle.
The 30% recovery capacity of level H means a logo can cover up to roughly 30% of the total module area before the code becomes undecodable. In practice, keep the logo under 20–25% of the total area — the remaining margin covers real-world degradation (dirt, wear, print imperfections) that accumulates on top of the intentional logo coverage.
Two structural regions must never be covered by a logo regardless of error correction level:
- Finder patterns — the three large squares in three corners. These are not covered by error correction; if they are damaged, the scanner cannot locate or orient the code at all.
- Format information strips — the 15-module strips adjacent to the finder patterns that encode the ECC level and mask number. Without this information, the decoder cannot begin parsing the data area.
Centering the logo (which is standard practice) naturally avoids these corner regions as long as the logo is not excessively large. See the complete logo best practices guide for sizing, contrast, and print testing recommendations.
Quick reference table
| Level | Recovery capacity | Capacity impact | Best for |
|---|---|---|---|
| L | ~7% | Highest data capacity | Digital display, high-quality printing, no logo |
| M | ~15% | Moderate reduction | General-purpose default, business cards, brochures |
| Q | ~25% | Significant reduction | Industrial, outdoor, textured print substrates |
| H | ~30% | Lowest data capacity | Logo overlay, extreme wear, no-lamination outdoor |
Try different error correction levels
QRonimo lets you switch between L, M, Q, and H in real time and watch the code change in your browser. Try encoding the same URL at each level and compare the resulting code sizes — everything happens client-side, no data is sent anywhere.
Open the QR Code Generator →