"Use error correction level H so it survives a bad print" is common advice for QR codes. We wanted to know how much blur a QR code actually tolerates, and whether a higher error correction level buys you anything. So we generated codes in Node, blurred them in steps with sharp, and decoded every version with jsQR.
Short version: a code still decoded with a Gaussian blur of about half a module (one of the little squares) and failed from 0.6 module. The result was the same at error correction levels L, M and H.
The setup
Three packages: qrcode-generator to build the matrix, sharp to render and blur, and jsqr to decode.
import qrcode from "qrcode-generator";
import sharp from "sharp";
import jsQR from "jsqr";
const TEXT = "https://endureqr.com/guides/blurry-qr-code";
const MOD = 10; // pixels per module
async function render(level) {
const q = qrcode(0, level); // 0 = smallest version that fits
q.addData(TEXT);
q.make();
const n = q.getModuleCount();
const size = (n + 8) * MOD; // 4-module quiet zone on each side
let rects = "";
for (let r = 0; r < n; r++)
for (let c = 0; c < n; c++)
if (q.isDark(r, c))
rects += `<rect x="${(c + 4) * MOD}" y="${(r + 4) * MOD}" width="${MOD}" height="${MOD}"/>`;
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}">
<rect width="100%" height="100%" fill="#fff"/><g fill="#000">${rects}</g></svg>`;
return sharp(Buffer.from(svg)).png().toBuffer();
}
async function decodes(png) {
const { data, info } = await sharp(png).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
return jsQR(new Uint8ClampedArray(data), info.width, info.height)?.data === TEXT;
}
for (const level of ["L", "M", "H"]) {
const base = await render(level);
for (const sigma of [1, 2, 3, 4, 5, 6, 7, 8, 10, 12]) {
const ok = await decodes(await sharp(base).blur(sigma).png().toBuffer());
console.log(level, `blur ${sigma / MOD} module`, ok ? "ok" : "fail");
}
}
The key detail is measuring blur relative to the module size. Blur in pixels means nothing on its own: 5 px of blur barely touches a code with 20 px modules and destroys one with 4 px modules.
Results
| Test | Result |
|---|---|
| Gaussian blur up to 0.5 module | Decodes at L, M and H |
| Gaussian blur of 0.6 module or more | Fails at L, M and H |
| Same printed size, 42-char vs 121-char URL | The long URL failed at roughly half the blur (σ 3 px vs 6 px) |
| JPEG at 3 px/module, quality down to 2 | Still decodes |
| 1–2 px/module PNG upscaled with smoothing | Still decodes digitally (but prints fuzzy) |
| Blur 0.5 module, then threshold to black/white | Decodes; at 0.7 module it doesn't |
Why error correction doesn't help
QR error correction is Reed–Solomon over codewords. It recovers a limited number of wrong or missing codewords: about 7% at L, 15% at M, 25% at Q and 30% at H. That's ideal for a logo in the middle, a scratch or a torn corner, which are localised damage.
Blur isn't localised. It softens every module edge at once. Below about half a module, the sampled centre of each module is still clearly dark or light, so every codeword reads correctly and error correction has nothing to do. Above that, neighbouring modules bleed into each other everywhere at the same time, far more codewords go wrong than any level can repair, and the decode fails. So the cliff sits at the same place for L and H.
What does help is bigger modules. You get them from:
- Shorter content. Fewer bytes means a lower QR version (fewer modules) at the same printed size. Our 121-character URL needed a 45×45 grid, while the 42-character one fit in 29×29.
- A larger print.
- Lower error correction, counter-intuitively, when blur rather than damage is the risk. Level H adds modules, which makes each one smaller.
Caveats
This is a clean digital test with one decoder. A phone camera adds its own defocus, motion blur, noise and perspective, so real-world margins are smaller than these numbers. Treat 0.5 module as the point where you've already lost, not as a target.
Practical takeaways
- Export SVG or PDF for print. If you must ship a PNG, use about 300 px per inch of printed width, and scale by whole numbers with nearest-neighbour.
- Keep the encoded string short. A short link is the cheapest blur insurance there is.
- Don't reach for level H to fix blur. Use it when you're covering part of the code (logos) or expect scratches.
- If you're blurring a QR code in a screenshot for privacy, a light blur probably still decodes. Cover it with a solid box.
We wrote up the non-code version, covering causes, print fixes and how to safely blur a code in a photo, here: Blurry QR code: why it happens and how to fix it. If you want to try decoding your own blurry images, the browser-based QR scanner uses the same jsQR decoder and doesn't upload anything.
Disclosure: we build EndureQR, a QR code generator. The test code above is everything we ran.

Top comments (1)
nice test, and the half-a-module cliff makes sense. two things I'd be curious about if you run it again.
on paper the blur often isn't symmetric. ink spreads on uncoated stock and on cheap thermal printers, so dark modules get fatter and the light gaps between them shrink. a gaussian blur keeps the dark/light midpoint where it was, ink spread moves it. you could fake that with a dilate step (or blur and then threshold below 50%) and see if the cliff comes earlier, and whether it hits small light gaps like the ones inside the finder patterns first.
also jsQR is one decoder, and they don't always agree. when I check codes in images I run zxing-cpp and OpenCV's WeChat detector side by side, and on borderline images they can give different answers, so a second decoder would show how much of the cliff is the decoder and how much is the code.
one more real-world source of blur: phones have a minimum focus distance, so a code printed very small makes people hold the phone close enough that it's out of focus. that's the same problem from the other end, and sizing the code for the distance people actually scan from probably helps more than anything in the generator.
full disclosure I work on a small QR tool too.