QR Code Error Correction Explained — L, M, Q, H Levels Guide
Every QR code contains built-in error correction that allows it to remain scannable even when part of the code is damaged, dirty, or intentionally covered by a logo. This error correction is powered by Reed-Solomon codes — the same mathematical algorithm used in CDs, DVDs, satellite communications, and deep-space probes to recover data from corrupted signals. QR codes offer four error correction levels: L (Low, recovers 7% data loss), M (Medium, 15%), Q (Quartile, 25%), and H (High, 30%). The level you choose directly impacts the QR code's resilience to physical damage, its ability to accommodate a centered logo, its total number of modules, and its minimum scannable print size. Choosing the right error correction level is not a default you should leave to chance — it is a deliberate design decision that determines whether your QR code survives real-world conditions. This guide explains how each level works, the mathematics behind Reed-Solomon error correction in accessible terms, and provides concrete recommendations for selecting the right level based on your specific use case: business cards, outdoor signage, logo integration, product packaging, and more.
What is QR code error correction and why it matters
Error correction is the mechanism that makes QR codes fundamentally more robust than traditional barcodes. When a QR code is generated, the encoder does not simply convert your data into a pattern of black and white modules — it first adds a calculated amount of redundant data using Reed-Solomon error correction codes, then encodes both the original data and the redundancy into the module pattern. This redundancy is not random padding; it is mathematically computed so that a decoder can reconstruct any missing or corrupted data codewords from the surviving redundancy codewords alone. The result is a code that can lose a significant percentage of its modules to damage, dirt, printing defects, or intentional obstruction and still deliver the complete original data to the scanner without any loss or corruption.
This capability matters in every real-world QR code deployment. A QR code on a product label may be scratched during shipping. A code on a poster may be partially covered by a sticker or graffiti. A code printed on a business card may accumulate wear in a wallet over months. A code on outdoor signage fades under UV exposure and collects dirt and moisture. A code designed with a centered logo has modules permanently destroyed by the logo overlay. In every one of these scenarios, error correction is what determines whether the code scans successfully or fails completely. Without error correction, even a single damaged module could make the entire code unreadable. With appropriate error correction, the code degrades gracefully — continuing to function until the damage exceeds the correction capacity of the chosen level.
The ISO/IEC 18004 standard defines four error correction levels for QR codes, designated L, M, Q, and H. Each level specifies a different ratio of redundancy codewords to data codewords, which directly determines the maximum percentage of codewords that can be lost while still allowing full data recovery. The standard does not mandate which level to use — the choice is left to the QR code creator, which is why understanding these levels is essential for anyone generating QR codes for production use. The default level in most QR code generators is M (15%), which is a reasonable general-purpose choice but is not optimal for every scenario. Codes with logos need H. Codes for pristine digital screens can use L. Codes for harsh outdoor environments should use Q or H. Making an informed choice requires understanding what each level actually does and what it costs in terms of code complexity.
The four error correction levels: L, M, Q, and H explained
Level L (Low) provides the minimum error correction, recovering approximately 7% of damaged codewords. This level adds the least redundancy, producing the smallest and simplest QR code for any given data payload. Because fewer modules are needed for redundancy, a level-L code uses a lower QR code version (fewer modules per side) than the same data encoded at higher levels. Level L is appropriate when the QR code will exist in a controlled, pristine environment — displayed on a digital screen, printed on a high-quality surface that will not be exposed to wear, or used in a short-lived context where damage is extremely unlikely. The most common use case for level L is encoding long data payloads (such as lengthy URLs or large text blocks) where minimizing the number of modules is critical for scannability and the code will be displayed digitally rather than printed.
Level M (Medium) recovers approximately 15% of damaged codewords and is the default in most QR code generators. It represents a practical middle ground: enough redundancy to handle minor printing imperfections, light surface wear, and small amounts of dirt or damage, without significantly increasing the code's size. Level M is the recommended choice for standard business use cases where the code is printed on quality materials and used in normal indoor conditions — business cards, brochures, product packaging stored indoors, restaurant table tents, and office signage. It handles the typical range of real-world imperfections that occur during normal printing and handling without the size overhead of higher levels.
Level Q (Quartile) recovers approximately 25% of damaged codewords, providing strong protection against significant damage. The name Quartile reflects that roughly one quarter of the code's data can be lost and still recovered. Level Q is designed for environments where the code faces meaningful physical stress: outdoor signage exposed to weather and UV degradation, warehouse and logistics labels subject to handling damage, codes printed on materials that crease or fold, and any deployment where the code's surface condition cannot be controlled or guaranteed over its useful life. The additional redundancy increases the code's module count noticeably compared to levels L and M, so codes at level Q are visually denser and require either a larger print size or a higher-quality printer to maintain scannable module sizes.
Level H (High) provides the maximum error correction, recovering approximately 30% of damaged codewords. This is the level required for QR codes that incorporate a centered logo, because the logo physically destroys the modules it covers. A logo typically obscures 10-15% of the code area, and level H's 30% recovery capacity provides the necessary margin to accommodate this intentional damage plus any additional wear, printing defects, or environmental degradation. Level H is also the right choice for codes deployed in the harshest conditions: outdoor codes expected to last months or years, industrial codes in manufacturing environments with grease, chemicals, or abrasion, and any scenario where maximum resilience is more important than code compactness. The tradeoff is significant — a level-H code may require a QR version two or three steps higher than level L for the same data, meaning substantially more modules and a more complex visual pattern.
How Reed-Solomon error correction works in QR codes
Reed-Solomon error correction is a block-based algorithm that operates on groups of data symbols (codewords) rather than individual bits. In QR codes, each codeword is 8 bits (one byte), and Reed-Solomon processing happens at this byte level. The mathematical foundation is Galois Field arithmetic — specifically GF(256), a finite field with 256 elements that maps perfectly to 8-bit byte values. All addition, subtraction, multiplication, and division in Reed-Solomon calculations happen within this finite field, which ensures that every intermediate and final result is a valid 8-bit value. This is not arbitrary mathematical elegance; it is a practical requirement that ensures the parity codewords generated by the algorithm can be encoded into the same 8-bit module groups as the original data.
The encoding process treats the data codewords as coefficients of a polynomial. For example, if the data consists of codewords [67, 85, 70, 134], the encoder constructs the polynomial 67x^3 + 85x^2 + 70x + 134. This data polynomial is then divided by a generator polynomial specific to the number of error correction codewords required, and the remainder of this polynomial division becomes the error correction codewords. These parity codewords are appended to the data codewords and together they form the complete message that is encoded into the QR code's modules. The key mathematical property is that the combined message (data plus parity) is exactly divisible by the generator polynomial. Any damage that alters codewords breaks this divisibility, and the pattern of the non-zero remainder tells the decoder exactly which codewords are wrong and what their correct values should be.
During decoding, the scanner reads all codewords (both data and parity) from the QR code modules and performs syndrome calculation — evaluating the received polynomial at specific points. If all syndromes are zero, the data is undamaged. If syndromes are non-zero, the decoder uses algorithms like the Berlekamp-Massey algorithm or Euclidean algorithm to find the error locator polynomial, which identifies which codeword positions are corrupted. Then Forney's algorithm calculates the error magnitudes — the actual values needed to correct each corrupted codeword. The maximum number of codewords that can be corrected equals half the number of parity codewords. This is why level H, which uses the most parity codewords, can correct the most errors. The entire process is deterministic: if the number of errors is within the correction capacity, the original data is recovered perfectly and completely, with zero ambiguity.
Practical recommendations: choosing the right level for every use case
For business cards, use level M. Business cards are handled frequently, stored in wallets, and accumulate surface wear over weeks or months, but the wear is generally moderate. Level M's 15% recovery handles these conditions well without making the QR code unnecessarily dense on a small card where print space is limited. If the business card includes a logo in the QR code, upgrade to level H regardless of other considerations — the logo's module destruction demands maximum error correction. For standard URL QR codes displayed digitally or printed for short-term indoor use, level L is sufficient. Digital displays produce perfect codes with no printing imperfections, and short-term indoor prints face minimal degradation risk. Using level L keeps the code compact and maximizes scannability for longer URLs.
For QR codes with logos, always use level H. This is a non-negotiable recommendation. The logo covers and destroys modules in the center of the code, and level H's 30% recovery capacity is required to absorb this intentional damage while retaining margin for the normal wear and scanning imperfections that every printed code encounters. Using level Q or lower with a logo creates a fragile code that may work in testing but fails in production when even minor additional damage pushes the total loss beyond the correction threshold. The logo should cover no more than 10-15% of the code area even with level H, and it should be centered to distribute the damage evenly across the code's data regions rather than concentrating it in one area.
For outdoor signage, use level Q as the baseline. Outdoor codes face UV fading, rain damage, dirt accumulation, temperature cycling, and potential physical damage from wind, vandalism, or accidental contact. Level Q's 25% recovery provides robust protection against these cumulative effects. If the outdoor code also includes a logo, use level H. For temporary outdoor codes expected to last only a day or two (event signage, market stalls), level M may be acceptable. For product packaging in retail environments, level M is typically appropriate — retail packaging is handled but not abused, and the printing quality on commercial packaging is high. For industrial and warehouse labels, use level Q or H depending on the environment's severity: Q for clean warehouses, H for manufacturing floors with grease, chemicals, or heavy handling.
For codes intended to be printed at very small sizes (under 2 cm), prefer level L or M to minimize the number of modules. More modules at a small physical size means each module is tiny, which makes the code harder to scan. The error correction benefit of higher levels is counterproductive if the resulting module density makes the code unscannable at the intended print size. In these cases, reducing the data payload (using a shorter URL or dynamic redirect) is more effective than increasing error correction. Conversely, for codes that will be printed large (10 cm or more), the size penalty of level Q or H is negligible and the additional protection is essentially free. As a general principle: when in doubt, use level M for standard use and level H when a logo is involved. These two choices cover the vast majority of real-world QR code applications correctly.
Pro Tips
Frequently asked questions
Create Your QR Code Now
Join businesses worldwide using QRWink to connect with their audience.
Start for free