Xerobit
Dev Productivity

QR Code Not Scanning? Causes, Fixes and Measured Limits

QR code not scanning? A symptom table plus measured limits for contrast, quiet zone, logo size per error correction level, blur, tilt, curvature and URL length.

MA Mian Ali Khalid Updated Nov 17, 2026 9 min read
Free tool
QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, contact cards. Custom size, colors, error correction. Download as PNG or SVG. 100% client-side.
Open tool →
On this page ⌄
  1. Diagnosis table
  2. Phone side: why is my phone not scanning QR codes?
  3. Contrast: dark on light, and do not invert
  4. Quiet zone: leave 4 modules
  5. Too dense for its size: pixels per module and URL length
  6. Damaged or logo-covered codes: error correction
  7. Glare, tilt, rotation and curved surfaces
  8. If it works on one phone but not another
  9. Print test protocol
  10. Tested
  11. Sources

A QR code that will not scan almost always has one of these problems: too little contrast, no blank margin (quiet zone) around it, modules that are too small in the camera image (code too dense for its size, too far away, or blurred), damage or a logo covering more than the error correction can repair, glare, or a surface that bends the code. If the code works on some phones and not others, or on screen but not on paper, the cause is usually the first three. A fresh code from the QR Code Generator in black on white, with the default margin and a short URL, is the quickest way to tell whether the code or the phone is at fault.

The limits below come from generating codes and decoding them with two independent software decoders while one factor changed at a time. They are software decoders, not phone cameras: they show where decoding starts to fail and in what order, and phones will differ.

Diagnosis table

What you seeMost likely causeFix
Scans on screen, not on paperPrinted too small, or ink spread closed up the modulesPrint larger and do a proof; for sizes by scan distance see the QR code minimum size guide
Phone camera shows the code but never reactsColours too close in brightness, or light code on dark backgroundDark code on a light background, contrast ratio 4.5:1 or more
Fails only when the code sits against a card edge, border or photoNo quiet zoneLeave 4 modules of plain background on every side
Worked until a logo was addedLogo hides more than the error correction level can restoreUse level H, keep the logo small (table below)
Slow or only scans at one angleToo many modules for the printed size (long URL), or blurShorten the URL, print larger, focus
Bright spot on a glossy print or screenGlare hides part of the code, especially a corner squareChange the angle or lighting, or print on matte stock
Code wrapped around a bottle or tubeCurvature squeezes the edgesMake the code narrower, place it on the flattest area
Works on one phone, not anotherMarginal quality: decoders differ in how much they tolerateFix contrast, margin and size first, then retest on both
Scans in the generator, fails in the finished designDesign tool resampled, recoloured or cropped the imageExport SVG, place it unscaled, no filters, check the margin survived

Phone side: why is my phone not scanning QR codes?

If a freshly generated black-on-white code also fails, the problem is the phone, not the code. Check these in order: the camera lens is clean; the code fills a good part of the frame and is in focus (move back until the code is sharp); lighting is even; the camera is in its normal photo mode and the whole code is in the frame; and a different scanner app reads it. Apple's iPhone User Guide says to open Camera in Photo mode and frame the code, or to use the Scan Code control in Control Center, where tapping the flashlight adds light. Google's Pixel Phone Help says to keep the entire code visible, hold steady, avoid shadows and glare, wipe the lens, move closer, and confirm Camera, Settings, More settings, Camera scan suggestions is on (menu names on other Android brands differ and were not checked). The decoders in this article cannot test phone settings, so everything in this paragraph is troubleshooting advice, not a measured result.

Contrast: dark on light, and do not invert

Contrast was computed with the WCAG ratio, (L1 + 0.05) / (L2 + 0.05), using the relative luminance formula from the W3C WCAG 2.1 glossary. Ten different URLs were rendered as codes (6 pixels per module, quiet zone 4) with a gray foreground on white, then blurred with a Gaussian of 1.0 or 1.4 pixels and given Gaussian noise (standard deviation 12 or 20 gray levels, drawn independently for each of the three colour channels, so the noise left after conversion to gray is about 1.7 times smaller) to imitate a poor camera frame. Numbers are codes read out of 10, as ZXing-C++ / OpenCV.

Foreground on whiteContrast ratioClean renderBlur 1.0 px, noise 12Blur 1.4 px, noise 20
gray 6011.0310 / 1010 / 1010 / 10
gray 1005.9210 / 1010 / 1010 / 8
gray 1403.3610 / 1010 / 109 / 9
gray 1802.0710 / 1010 / 90 / 3
gray 2001.6710 / 104 / 80 / 0
gray 2201.3710 / 10 (8 / 9 with noise)0 / 00 / 0

On a perfect render, even 1.4:1 decodes, so a code that "looks fine" on screen can still fail once a phone adds blur and sensor noise: with this imaging model decoding degraded below roughly 3:1 and failed at about 2:1 and below. With the same noise applied to a single gray channel (about 1.7 times stronger after gray conversion), 1.4 blur and 20 noise already broke most codes at 3.4:1, and 1.0 blur and 12 noise broke most at 2:1, so the margin you need depends on how noisy the camera image is. Use at least 4.5:1 and aim for black on white (21:1). Check any colour pair with the Color Contrast Checker.

Hue alone does not help. Green (#00a000) on red (#c80000) has a ratio of only 1.74 and navy on black 1.31; ZXing-C++ read both clean renders, OpenCV read neither, because brightness, not colour, separates the modules.

Inverted (light on dark) codes: 5 clean renders of white modules on black were tested. ZXing-C++ read 0 of 5 with its invert option off and 5 of 5 with it on. OpenCV read 0 of 5 as given, and 5 of 5 after the image was flipped to dark-on-light. So support depends on the app; print dark on light unless you have tested the exact phones.

Quiet zone: leave 4 modules

The quiet zone is the blank border around the code. The widely used figure is 4 modules: the ZXing library's QR writer uses a constant QUIET_ZONE_SIZE = 4 (ZXing source), and Denso Wave states that a margin is required around a QR Code without giving a number on that page. The ISO/IEC 18004 text itself is paywalled and was not read.

Ten codes were rendered with the margin cut from 4 modules to 0, once on plain white and once on a dark card (a dark band touching the margin edge). ZXing-C++ / OpenCV, out of 10:

MarginOn whiteOn a dark card
4 modules10 / 1010 / 10
3 modules10 / 1010 / 10
2 modules10 / 1010 / 10
1 module10 / 1010 / 10
0 modules10 / 00 / 0

With no margin, OpenCV failed even on white and neither decoder read the code against the dark card. In the real world the margin is rarely clean white: a coloured border, photo or card edge competes with the three corner squares, so keep the full 4 modules (the tool's margin setting does this).

Too dense for its size: pixels per module and URL length

A decoder needs several camera pixels per module. Short-URL codes of version 2, 5 and 10 (25, 37 and 57 modules per side, error correction L) were rendered large, then shrunk to a given number of pixels per module with a random sub-pixel shift. Numbers: codes read out of 10, as ZXing-C++ / OpenCV.

Pixels per moduleVersion 2Version 5Version 10
8 to 310 / 1010 / 1010 / 10 (10 / 7 at 4)
2.510 / 1010 / 210 / 1
210 / 810 / 1010 / 9
1.58 / 110 / 010 / 0
1.23 / 02 / 01 / 0

OpenCV is not monotonic here (2 pixels read better than 2.5 for version 5): resampling alignment matters at these sizes. The safe reading is that both decoders are comfortable at 3 or more pixels per module on a clean image, and unreliable below about 2.5. Combine that with blur: with 8-pixel modules and a Gaussian blur, ZXing-C++ read all 10 codes up to a blur radius (sigma) of half a module and none at three-quarters; OpenCV read all at a quarter module and none at half. Blur is why an out-of-focus phone fails on a code it could read sharp.

The version (module count) grows with the data. Version 1 is 21 x 21 modules and each version adds 4 modules per side, up to version 40 at 177 x 177 (Denso Wave, QR Code versions). The same text encoded at each error correction level, by the Python library segno and re-checked with the npm qrcode library (identical results in all 28 cells; module counts in brackets):

ContentLMQH
https://xerobit.dev/ (20 characters)v2 (25)v2 (25)v2 (25)v3 (29)
44-character URLv3 (29)v4 (33)v4 (33)v5 (37)
104 charactersv5 (37)v6 (41)v8 (49)v10 (57)
200 charactersv9 (53)v10 (57)v12 (65)v15 (77)
400 charactersv13 (69)v15 (77)v19 (93)v21 (101)
800 charactersv20 (97)v23 (109)v27 (125)v32 (145)
1,200 charactersv25 (117)v29 (133)v34 (153)v39 (173)

(The test strings were plain lowercase letters after a URL prefix. An encoder can shorten text containing long digit runs or capitals-and-digits only, so real URLs may land on a smaller version.) Fixed image width shows the effect: at error correction M and a total width of 250 pixels including margin, a 104-character URL gave 5.1 pixels per module and read 6 of 6 in both decoders, while a 400-character URL gave 2.9 pixels per module and OpenCV read 0 of 6. At 150 pixels wide, 200 characters already failed OpenCV (2 of 6). Shortening the URL or using a short redirect link fixes this without making the print larger, and a redirect lets you change the destination later without reprinting.

Damaged or logo-covered codes: error correction

The four levels can restore about 7% (L), 15% (M), 25% (Q) and 30% (H) of codewords according to Denso Wave's error correction page and Wikipedia's QR code article; Denso Wave's error correction page gives M as 15% and Q as 25%, and says the code can be restored if it is dirty or damaged. Higher levels make the code denser for the same data (table above).

Those are shares of codewords, not of the printed area, and a solid block is harder than scattered damage. A white square was placed in the centre of a version 6 code (41 x 41 modules, a 55-character URL) and grown. Ten different URLs per cell; the percentage is the share of the symbol area (margin excluded). The row shows the largest share where all 10 codes read in both decoders; both decoders gave the same counts in every cell.

LevelNominal restoreLargest white block read 10 / 10Mixed resultsFailed
L7%about 4 to 6%6%: 7 / 107 to 8% and up
M15%about 10%12%: 9 / 10, 14%: 4 / 1016% and up
Q25%about 13 to 14%15%: about half16% and up
H30%about 17 to 19%19%: ZXing-C++ all, OpenCV about two thirds21 to 25% and up

So the usable blocked area was roughly 55 to 65% of the nominal figure. A logo that is a busy pattern (a checkerboard of dark and light modules) instead of a white block behaved similarly: all read up to about 4 to 6% (L), 10% (M), 13% (Q) and 19% (H), with M at 2 to 7 of 10 at 12% and H at 5 of 20 at 21.5%. The usable share also depends on the version: on a 29 x 29 code (version 3) the largest white block read in full was about 3% (L), 8% (M) and 12% (Q and H); on a 57 x 57 code (version 10) about 11% (M), 19% (Q) and 22% (H). A larger version has more codewords, so the same percentage of area costs less. For a logo, use level H, keep it well under 15% of the area (less on a small code), and test on the phones you care about. This is one code layout per size; others will differ.

Glare, tilt, rotation and curved surfaces

Each row is one change to an otherwise clean code (ten codes, error correction M, except glare which used H). Counts are ZXing-C++ / OpenCV out of 10.

ConditionTested up toResult
Rotation, canvas padded so nothing is cropped0, 15, 30, 45, 60, 90, 135, 180, 270 degrees10 / 10 at every angle
Perspective tilt (top edge narrower than the bottom)top edge 90% of bottom: 10 / 10; 80%: 10 / 10; 70% down to 30%: 10 / 0OpenCV stopped once the top edge was 70% of the bottom; ZXing-C++ read every step
Soft white glare spot in the centre12% of the image: 10 / 10; 16%: 0 / 10; 20% and 30%: 0 / 0The exact size where it fails depends on how the spot is drawn: a second run with a different spot shape lost ZXing-C++ at 12%
Soft white glare spot on one corner square4% of the image: 0 / 0A glare spot on a finder pattern was fatal
Code wrapped on a cylinder, view arc 69 degrees10 / 10
Cylinder, view arc 92 degrees10 / 0
Cylinder, view arc 115 degrees0 / 0

Rotation is not a cause of failure: codes read at any angle. Glare is, if it lands on one of the three large corner squares. A curved surface only matters once the code spans a large arc: if the code is narrow compared with the bottle or tube it sits on, the edge squeeze stays small.

If it works on one phone but not another

Both decoders agree on the ordering of failures: contrast and size/blur fail gradually and differently per decoder, while a missing margin, a covered corner square and over-large logos fail abruptly. So a code that one phone reads and another does not is almost always marginal in contrast, size or blur rather than broken: fix those, then retest on both phones. If nothing helps and the new code made with the QR Code Generator also fails on that phone, the phone is the cause (see the phone checks above).

  1. Export SVG at the final size; do not scale a raster.
  2. Print a proof on the real stock and finish, at the real size.
  3. Scan from the furthest distance you expect, on at least one iPhone and one Android phone, in the real lighting.
  4. Scan at a slight angle and slightly out of focus.

Tested

2026-11-17. Every table was produced twice with different generated payloads and agreed within the ranges stated; the camera noise level was the one setting that moved the contrast limits. Python 3.11.15 with segno 1.6.6 (code generation), zxing-cpp 3.1.1 (ZXing-C++ decoder, QR format only), opencv-python-headless 5.0.0.93 (QRCodeDetector), numpy 2.4.6. The npm qrcode 1.5.4 under Node 25.8.0 re-generated the version table (identical in all 28 cells). Codes were rendered by script (8 pixels per module unless stated, quiet zone 4 unless stated), 10 different 55-character URLs per cell unless stated (short URLs for the pixels-per-module table, six noise draws per cell for the fixed-width runs). Not tested: real phone cameras, printed paper, glossy surfaces, ink spread, lighting changes, video streams, or any scanning app. The results show relative limits of two software decoders, not what a given phone will do. The ISO/IEC 18004 standard text was not read.

Sources

Keep reading

Related tools

Written by Mian Ali Khalid. More guides in Dev Productivity.