A logo on a QR code: error correction levels and how big it can be

What the L, M, Q and H error correction levels really mean, how a logo eats into them, and a worked example showing how large a centre logo can safely get.

A logo on a QR code: error correction levels and how big it can be
On this page

Put a logo in the middle of a QR code and it still scans. That feels like a trick, but it is not. The code was built to survive damage, and a logo is simply damage you chose on purpose.

The catch is that the code can only absorb so much. Every module you hide behind a logo comes out of the same budget that also has to cover glare, a smudge on the print, a crease in a menu or a phone held at an angle. This post shows how that budget works, with real numbers, so you can pick a logo size that leaves enough room for the real world.

What L, M, Q and H actually mean

A QR code stores your text as bytes, called codewords. On top of the data, it adds extra check codewords computed with Reed–Solomon coding, the same family of codes used on CDs. The error correction level decides how many check codewords are added.

LevelShare of codewords it can restoreTypical use
Labout 7%clean screens, short-lived codes
Mabout 15%the usual default
Qabout 25%rough surfaces, outdoor print
Habout 30%codes with a logo, harsh conditions

Two details are easy to miss. First, the percentage is of codewords, not of the code's width or area. Second, a scanner does not know which parts are hidden by your logo. To the decoder, the dark and light squares under the logo look like ordinary data that happens to be wrong. Fixing an error at an unknown position costs two check codewords, which is why at level H about two thirds of all codewords are check codewords, yet it restores only about 30%.

How a logo spends the budget

A codeword is 8 bits, so it occupies 8 modules (the little squares) on the grid, usually in a block two modules wide. If your logo touches even one of those 8 modules, the whole codeword counts as damaged. That is why a logo always damages a bigger share of codewords than the share of the area it covers.

The data is also split into several blocks, each with its own check codewords, and the blocks are interleaved across the grid. A logo in the centre therefore hurts every block a little instead of wiping out one block completely. That is good news, but it also means the limit that matters is per block: the code fails as soon as any single block has more damage than it can fix.

The parts you must never cover are the three large squares in the corners (the finder patterns), the thin dotted lines between them (timing patterns) and the strips next to the finders that hold the format information. A centre logo stays clear of all of them, which is why the centre is the standard spot.

A worked example with one URL

Take a menu link: https://example.com/menu?table=12&lang=vi, 41 characters. Encoded at each level, it produces a different code, because more check codewords need more room. Now cover the centre of each one with the same logo, 7 by 7 modules, about a fifth of the width.

LevelVersion, sizeCodewordsBlocksFixable per blockDamaged by the logoSpare per block
L3, 29×29701712none, it fails
M3, 29×2970113121
Q4, 33×33100213 each4 and 69 and 7
H5, 37×37134411 each3 in each8 each

The logo covers 49 modules. At level L that breaks 12 codewords in a code that can fix 7, so it never scans. At M it scans on a perfect screen, with one codeword to spare, so the first speck of dust ends it. At H each block uses 3 of its 11 repairs, leaving 8 for everything else.

Now push the logo up at level H:

Logo sizeShare of widthShare of areaCodewords damagedWorst block
7×719%3.6%12 (9%)3 of 11
9×924%5.9%15 (11%)4 of 11
11×1130%8.8%21 (16%)6 of 11
13×1335%12.3%31 (23%)9 of 11

Look at the last two columns. The 11×11 logo covers under 9% of the area but damages 16% of the codewords. At 13×13 the code still decodes in theory, yet the worst block has only 2 repairs left. A printed menu on a café table will use those up quickly.

Why the safe limit is lower than 30%

"Level H fixes 30%, so my logo can be 30% wide" is the most common mistake. As the tables show, 30% of the width is about 9% of the area, which is already about 16% of the codewords. A logo 30% of the area would be well past what any level can recover.

Leave room for real damage too. A rule of thumb that holds up in practice: let the logo use no more than about half of what each block can repair. In the example that means up to 5 or 6 damaged codewords per block at H, which is the 11×11 logo for this URL.

The QR code generator builds this in. Adding a logo switches the code to level H automatically, the size slider goes from 10% to 30% of the width, and at H the logo is held to 26% of the width, rounded to whole modules. The scan-safety panel also warns when the logo uses most of that room, so you know before you print, not after.

What level H costs you

More check codewords take more space. In the example, the same link grows from 29×29 modules at M to 37×37 at H. If each module must be at least 0.4 mm to print reliably (about five dots on a 300 dpi printer), plus a 4-module blank margin on every side, the smallest printable size goes from:

  • M: (29 + 8) × 0.4 = 14.8, so about 15 mm
  • H: (37 + 8) × 0.4 = 18 mm

Three millimetres is nothing on a poster, but it matters on a business card or a product label. The cheapest way to win back space is to shorten the content. A 24-character link fits in a 29×29 code even at H, so the logo comes almost for free.

Very long content brings one more issue. From version 7 (45×45 modules) upward, the code has an alignment pattern right in the centre, exactly where the logo goes. Scanners usually cope, but it is one more reason to keep the payload short when you plan a logo.

Placing the logo so it scans

  • Keep it in the centre and away from the three corner squares.
  • Give it a light plate. A white backing square behind the logo, with the modules under it cleared, gives the scanner a clean blank area instead of half-hidden dots around the logo's edges.
  • Keep the contrast high. A dark code on a light background with a contrast ratio of at least 3:1, better 4.5:1 or more. A pale brand colour costs more than a logo does.
  • Do not fill the quiet zone. The blank margin around the code is part of it, not decoration.
  • Test the final file. The generator reads the finished code back with the same decoder as the QR code scanner. After printing, scan the paper with two different phones, from arm's length and at an angle.

Summary

A logo works because of error correction, and it uses up some of that correction before the code ever leaves your screen. Use level H, keep the logo in the centre at roughly a quarter of the width, keep the content short, and test the printed result. Then the code still has repairs left for the coffee stain it will eventually meet.

Tools mentioned in this article

Back to the blog