QR Code Error Correction Levels Explained (L, M, Q, H)
The Setting You Probably Never Touched
If you have ever generated a QR code, you have almost certainly used a default error correction level without thinking about it. Most generators bury the option behind a dropdown labeled with single letters (L, M, Q, H) and offer no explanation. The defaults work fine for the majority of cases, which is why most people never learn what the setting actually does. But the moment you put a logo in the middle of a QR code, print it on a coffee cup that will get scratched, or paste a sticker on a lamp post where pigeons will inevitably contribute to it, the choice of error correction level becomes the difference between a code that scans and a code that does not.
This post is the explainer I wish existed when I first started caring about how QR codes survive contact with the real world. It covers what the four levels actually mean, the math that makes them work, the tradeoffs you are making each time you pick one, and a small set of rules of thumb for choosing well. None of it is mysterious once you know what is happening underneath; the standard is public, the math is from the 1960s, and the implementation in every modern QR library is honest about what it is doing.
What Error Correction Is Actually Doing
A QR code is a two-dimensional barcode that encodes data as a grid of black and white squares (called modules). The smallest QR codes (version 1) are 21 modules across; the largest (version 40) are 177 modules across. Inside that grid, the data is not stored linearly the way text is stored in a file. It is stored as a sequence of bytes, then expanded with extra bytes that encode redundancy. Those extra bytes are called error correction codewords, and the system that generates and decodes them is Reed-Solomon coding.
Reed-Solomon was invented by Irving Reed and Gustave Solomon in 1960 at MIT Lincoln Laboratory. It is the same family of error correction used on CDs, DVDs, deep-space probes, DSL modems, and the parity drives in a RAID 6 array. The reason it shows up in so many places is that it is mathematically optimal at recovering from a category of errors called erasures (you know which symbol was lost) and very efficient at recovering from random byte errors (you do not know which one was wrong). For a QR code, both kinds happen: a coffee stain is an erasure, a printer banding artifact looks more like a random error. Reed-Solomon handles both with the same machinery.
The practical effect is that a QR code does not need every single module to be readable. It needs enough of them to be readable that the decoder can reconstruct the original data using the redundancy that was baked in at generation time. The error correction level you pick controls how much redundancy is added.
The Four Levels
The QR code standard (ISO/IEC 18004) defines exactly four error correction levels. They are not user-tunable beyond this; you pick one of the four.
Level L (Low) can recover from approximately 7% of the codewords being damaged. This is the highest data capacity and the lowest resilience. You would use it for a QR code printed on a fresh page in a controlled environment that you know will be scanned indoors.
Level M (Medium) can recover from approximately 15% damage. This is the default in many generators because it is a reasonable balance: still high data capacity, but enough redundancy to survive minor smudging, low-resolution printing, or imperfect lighting at scan time.
Level Q (Quartile) can recover from approximately 25% damage. The capacity penalty is noticeable here — you are roughly halving the data you can encode compared to L at the same version — but you are buying real-world durability. Q is a sensible choice for anything printed at small sizes, anything that will be displayed outdoors, or anything where a logo or other visual element will partially obscure the code.
Level H (High) can recover from approximately 30% damage. This is the maximum the standard supports, and it is what you want when you know the code will get abused. Stickers on industrial equipment, codes etched into metal that will tarnish, codes printed on flexible substrates that will flex and crack, codes with a fairly large company logo dropped in the middle: all of these are level H territory.
The Big Caveat About 30 Percent Damage
The percentages are the most-quoted statistics about QR codes, and they are also the most-misunderstood. A level H code does not survive 30% of its visible area being missing in any arbitrary shape. The 30% figure refers to the fraction of codewords (the bytes that encode the data after Reed-Solomon expansion) that can be corrected. That is closely related to area, but not identical, and there are some structural elements that are not protected by error correction at all.
The three large square finder patterns in the corners are the scanner's first reference points; they tell the camera where the code is and how it is rotated. If a finder pattern is obliterated, the scanner does not know how to start decoding, and no amount of error correction will help. The timing patterns (the dashed lines running between the finder patterns) and the format information (the modules around the finder patterns that encode the error correction level and the mask pattern) are similarly critical. The error correction mostly protects the data area in the middle of the code, not the locator and metadata around the edges.
The practical upshot is that a level H code with a logo neatly centered in the data area will scan reliably, while a level H code with one finder pattern scratched off may not scan at all. The error correction budget is for the data zone, not the structural elements.
How the Capacity Tradeoff Actually Looks
Every codeword spent on redundancy is a codeword not spent on data. At the same QR version (same physical grid size), going from level L to level H reduces your data capacity to roughly 60% of what it was. For a typical version 5 code (37 modules across), level L holds around 108 bytes of binary data; level H holds around 46 bytes. That is a real penalty if you are trying to encode a long URL with UTM parameters, or a vCard with several phone numbers, or a Wi-Fi credential string with a long password.
The generator's response, when the data does not fit at the requested error correction level, is to step up to a higher QR version with more modules. So if you ask for level H on a long URL, you get a physically denser code (more squares per side). That is fine if you have room to print the code at a usable size, but it gets expensive fast: a denser code needs to be printed larger to remain scannable at the same distance and camera resolution. If you have a fixed physical area to print into, the tradeoff is fewer characters at the same density, or the same characters at higher density, and neither is free.
The right mental model is that error correction, data length, and physical print size are three legs of a stool. You can hold any two fixed, but the third will move. Generating the code locally and watching the result update as you adjust the inputs is the fastest way to develop intuition for which combinations work.
Rules of Thumb for Picking a Level
The following heuristics will steer you well 95% of the time.
For a QR code embedded in a digital document that will be scanned from a clean screen (a slide deck, a PDF, an email), level L or M is fine. The code is pristine, the lighting is controlled, the camera is close. You are paying for redundancy you will not use.
For a QR code on a printed business card, restaurant menu, or product packaging, level M is the conventional default and works well. The code will be small but not tiny, and the substrate is usually decent.
For a QR code printed on outdoor signage, vinyl decals, or anything that will see weather, level Q is the right starting point. UV fading, water damage, peeling edges, and accumulated grime all eat into the readable codewords.
For a QR code with a logo in the middle, level H is mandatory if the logo covers more than about 15% of the area. The logo is creating a localized erasure exactly where the data lives, and you need the redundancy to recover. The conventional wisdom is that a centered logo can safely cover up to 25 to 30 percent of the code's area at level H without breaking scannability, though the safe limit depends on where the logo overlaps relative to the data and structural patterns.
For a QR code etched into industrial equipment, printed on a curved bottle, or otherwise destined for an environment where you cannot control print quality or wear, level H. The capacity cost is the price of admission for the durability.
The Masking Step That Makes It All Work
There is one more piece of the QR pipeline worth mentioning, because it occasionally affects how a code looks. After the data and error correction bytes are placed in the grid, the encoder applies one of eight standard masks — bitwise patterns that XOR onto the data area. The point of the mask is to break up undesirable patterns: long runs of identical modules, accidental finder-pattern lookalikes in the data area, large solid blocks of one color that could confuse the scanner.
The encoder evaluates all eight masks against a scoring function defined in the standard, picks the one that minimizes the penalty, and records which mask it used in the format information bits around the finder patterns. The decoder reverses the mask before doing anything else. The reason this matters in practice is that two QR codes encoding identical data at identical error correction levels can look visibly different because they ended up with different masks. That is fine, and it is doing its job.
Designing With the Standard, Not Around It
QR codes have lasted long past the moment people thought they would disappear because the underlying engineering is unusually durable. Reed-Solomon is one of the most studied error correction schemes ever built; the four-level error correction ladder is a clean abstraction that exposes the right knob to the user without burying them in math; the masking step compensates for pathological data; the finder and timing patterns let phone cameras lock on at almost any angle and distance. None of this is accidental. The standard was designed by Denso Wave in 1994 for automotive parts tracking, where codes had to scan reliably after a part had been through manufacturing, shipping, and installation. The same properties that work in a factory work in the wild.
The upshot for anyone making a QR code today is that picking the right error correction level is a small decision with outsized consequences. Default to M for ordinary cases, step up to Q for outdoor or smaller-than-comfortable prints, and use H whenever you are obscuring part of the code on purpose or trusting it to a hostile environment. The capacity penalty is real but bounded, and the alternative — a code that looks fine but does not scan when someone actually points their phone at it — is the worse outcome by a wide margin.
Related Free Tools
Stay Informed
Get ecosystem updates
New tools, posts, and ecosystem news — no spam, unsubscribe anytime.