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.
On this page ⌄
- Diagnosis table
- Phone side: why is my phone not scanning QR codes?
- Contrast: dark on light, and do not invert
- Quiet zone: leave 4 modules
- Too dense for its size: pixels per module and URL length
- Damaged or logo-covered codes: error correction
- Glare, tilt, rotation and curved surfaces
- If it works on one phone but not another
- Print test protocol
- Tested
- 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 see | Most likely cause | Fix |
|---|---|---|
| Scans on screen, not on paper | Printed too small, or ink spread closed up the modules | Print larger and do a proof; for sizes by scan distance see the QR code minimum size guide |
| Phone camera shows the code but never reacts | Colours too close in brightness, or light code on dark background | Dark code on a light background, contrast ratio 4.5:1 or more |
| Fails only when the code sits against a card edge, border or photo | No quiet zone | Leave 4 modules of plain background on every side |
| Worked until a logo was added | Logo hides more than the error correction level can restore | Use level H, keep the logo small (table below) |
| Slow or only scans at one angle | Too many modules for the printed size (long URL), or blur | Shorten the URL, print larger, focus |
| Bright spot on a glossy print or screen | Glare hides part of the code, especially a corner square | Change the angle or lighting, or print on matte stock |
| Code wrapped around a bottle or tube | Curvature squeezes the edges | Make the code narrower, place it on the flattest area |
| Works on one phone, not another | Marginal quality: decoders differ in how much they tolerate | Fix contrast, margin and size first, then retest on both |
| Scans in the generator, fails in the finished design | Design tool resampled, recoloured or cropped the image | Export 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 white | Contrast ratio | Clean render | Blur 1.0 px, noise 12 | Blur 1.4 px, noise 20 |
|---|---|---|---|---|
| gray 60 | 11.03 | 10 / 10 | 10 / 10 | 10 / 10 |
| gray 100 | 5.92 | 10 / 10 | 10 / 10 | 10 / 8 |
| gray 140 | 3.36 | 10 / 10 | 10 / 10 | 9 / 9 |
| gray 180 | 2.07 | 10 / 10 | 10 / 9 | 0 / 3 |
| gray 200 | 1.67 | 10 / 10 | 4 / 8 | 0 / 0 |
| gray 220 | 1.37 | 10 / 10 (8 / 9 with noise) | 0 / 0 | 0 / 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:
| Margin | On white | On a dark card |
|---|---|---|
| 4 modules | 10 / 10 | 10 / 10 |
| 3 modules | 10 / 10 | 10 / 10 |
| 2 modules | 10 / 10 | 10 / 10 |
| 1 module | 10 / 10 | 10 / 10 |
| 0 modules | 10 / 0 | 0 / 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 module | Version 2 | Version 5 | Version 10 |
|---|---|---|---|
| 8 to 3 | 10 / 10 | 10 / 10 | 10 / 10 (10 / 7 at 4) |
| 2.5 | 10 / 10 | 10 / 2 | 10 / 1 |
| 2 | 10 / 8 | 10 / 10 | 10 / 9 |
| 1.5 | 8 / 1 | 10 / 0 | 10 / 0 |
| 1.2 | 3 / 0 | 2 / 0 | 1 / 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):
| Content | L | M | Q | H |
|---|---|---|---|---|
https://xerobit.dev/ (20 characters) | v2 (25) | v2 (25) | v2 (25) | v3 (29) |
| 44-character URL | v3 (29) | v4 (33) | v4 (33) | v5 (37) |
| 104 characters | v5 (37) | v6 (41) | v8 (49) | v10 (57) |
| 200 characters | v9 (53) | v10 (57) | v12 (65) | v15 (77) |
| 400 characters | v13 (69) | v15 (77) | v19 (93) | v21 (101) |
| 800 characters | v20 (97) | v23 (109) | v27 (125) | v32 (145) |
| 1,200 characters | v25 (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.
| Level | Nominal restore | Largest white block read 10 / 10 | Mixed results | Failed |
|---|---|---|---|---|
| L | 7% | about 4 to 6% | 6%: 7 / 10 | 7 to 8% and up |
| M | 15% | about 10% | 12%: 9 / 10, 14%: 4 / 10 | 16% and up |
| Q | 25% | about 13 to 14% | 15%: about half | 16% and up |
| H | 30% | about 17 to 19% | 19%: ZXing-C++ all, OpenCV about two thirds | 21 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.
| Condition | Tested up to | Result |
|---|---|---|
| Rotation, canvas padded so nothing is cropped | 0, 15, 30, 45, 60, 90, 135, 180, 270 degrees | 10 / 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 / 0 | OpenCV stopped once the top edge was 70% of the bottom; ZXing-C++ read every step |
| Soft white glare spot in the centre | 12% of the image: 10 / 10; 16%: 0 / 10; 20% and 30%: 0 / 0 | The 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 square | 4% of the image: 0 / 0 | A glare spot on a finder pattern was fatal |
| Code wrapped on a cylinder, view arc 69 degrees | 10 / 10 | |
| Cylinder, view arc 92 degrees | 10 / 0 | |
| Cylinder, view arc 115 degrees | 0 / 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).
Print test protocol
- Export SVG at the final size; do not scale a raster.
- Print a proof on the real stock and finish, at the real size.
- Scan from the furthest distance you expect, on at least one iPhone and one Android phone, in the real lighting.
- 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
- Denso Wave, QR Code error correction: https://www.qrcode.com/en/about/error_correction.html (M 15%, Q 25%, restoring dirty or damaged codes)
- Denso Wave, QR Code standards: https://www.qrcode.com/en/about/standards.html (ISO/IEC 18004, levels L 7%, M 15%, Q 25%, H 30%)
- Denso Wave, QR Code versions: https://www.qrcode.com/en/about/version.html (21 x 21 to 177 x 177, 4 modules per version)
- Denso Wave, how to generate: https://www.qrcode.com/en/howto/generate.html (a margin is required)
- ZXing QRCodeWriter source: https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java (quiet zone constant 4)
- Wikipedia, QR code: https://en.wikipedia.org/wiki/QR_code (error correction levels, ISO/IEC 18004 editions)
- W3C, WCAG 2.1: https://www.w3.org/TR/WCAG21/ (relative luminance and contrast ratio)
- Apple, iPhone User Guide, Scan a QR code with your iPhone camera: https://support.apple.com/guide/iphone/scan-a-qr-code-iphe8bda8762/ios (Camera in Photo mode, Control Center Scan Code, flashlight)
- Google, Pixel Phone Help, Scan QR codes with your Pixel phone: https://support.google.com/pixelphone/answer/16561572 (steps, Camera scan suggestions, troubleshooting tips)
Keep reading
QR Code Minimum Size: Measured Pixels, Centimetres by Distance and PNG vs JPG
QR code minimum size from decoder tests: pixels per module for versions 1 to 10, centimetres by scan distance, DPI for print, business card size and PNG vs JPG vs SVG.
WiFi QR Code Format: Exact WIFI: Payloads, Escaping and Scan Tests
The exact WiFi QR payload for WPA, WEP, open and hidden networks, the escaping rules for special characters, and a decode round trip of generated QR codes.
Related tools
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.
Hours Calculator
Add start, end and break times for each day to see daily hours, weekly totals and overtime instantly.
Character Counter
Count characters, words, sentences, lines and UTF-8 bytes with live SEO and social media limit tracking.
Keyboard Test
Press any key to see it light up and find dead, stuck or double-typing keys, with rollover checks for full size, TKL and 75% layouts.
Written by Mian Ali Khalid. More guides in Dev Productivity.