Published Aug 6, 2026
# QR Code Colors: What Actually Scans
QR codes do not have to be black on white — the scanner looks for contrast, not a specific hue. But the dark-on-light rule is physical, not stylistic: light modules on a dark background break most camera decoders, because the viewfinder auto-exposure locks onto the bright area and the code falls below its detection threshold. Our test of 8 color combinations: 7 scanned on the first attempt, the light-on-dark variant failed. Here is how to pick colors that scan on the first try.
Why "Black on White" Is the Default
A camera's auto-exposure aims for a mid-gray average, and a dense black module pattern is the strongest high-contrast object in the frame. That is why the ISO/IEC 18004 reference color — black modules on white — is also the one that survives bad lighting, cheap cameras and motion. Any other pairing must approximate that contrast ratio, and every point of contrast you lose is a point of scanning reliability you give up.
The Contrast Ratio Rule
Contrast ratio is the luminance of the lighter color divided by the luminance of the darker one, from 1:1 (identical) to 21:1 (white on black). WCAG 2.1 defines "AAA" large text as 7:1; we hold QR codes to the same bar. Ratios below about 4.5:1 start failing on older phones; below 3:1 they are effectively unscannable in real light. The scanner does not know your brand palette — it only knows there is enough difference between the two colors to threshold the modules.
Dark on Light: The Only Safe Direction
The dark element must be the module (the "1" pixel) and the light element the background. The reason is optical: phone cameras expose for the bright region, and a light code on a dark field is interpreted as a bright blob with noise inside — most decoder libraries, including the one behind our QR scanner, drop such candidates before even trying to read timing patterns. If a designer insists on a dark background, the fix is a white quiet zone plus a light card behind the code, not an inverted code.
8 Tested Color Combinations
We rendered the same URL payload (a 140-character link) at 800×800 px, version 12, error correction M, and scanned each 10 times from 30 cm on a Pixel 8, an iPhone 14 and a 2020 Samsung A51. First-try success rate:
| Module | Background | Contrast | 1st-try success | Verdict |
|---|---|---|---|---|
| #000000 | #FFFFFF | 21:1 | 30/30 | Reference |
| #1A237E | #FFFFFF | 14.2:1 | 30/30 | Safe |
| #004D40 | #FFFFFF | 12.9:1 | 30/30 | Safe |
| #B71C1C | #FFFFFF | 6.9:1 | 30/30 | Safe |
| #3366CC | #FFFFFF | 6.4:1 | 29/30 | Safe |
| #666666 | #FFFFFF | 5.8:1 | 28/30 | OK, avoid for small codes |
| #000000 | #F5F5F5 | 17.6:1 | 30/30 | Safe (off-white bg) |
| #FFFFFF | #000000 | 21:1 | 0/30 | Fails — inverted |
The last row is the one that surprises designers: identical contrast, opposite direction, total failure on all three phones.
Which Colors to Avoid
- Inverted (light on dark) modules — fails on nearly every scanner.
- Dark gray on black or any same-luminance pair — no threshold to find.
- Blue on black, navy on dark gray — looks fine on screen, contrast under 3:1.
- Red on green or other low-saturation complementary pairs at 40%+ size reduction.
- White modules on a colored background without a white quiet zone around the whole symbol.
Quick-Pick Safe Pairings
| Situation | Safe choice |
|---|---|
| Brand color is dark (navy, deep green, maroon) | Use it as the module color on white |
| Brand color is light (sky blue, pink, yellow) | Keep modules near-black; use the brand color as border or header, not background |
| Dark background is a design requirement | Put the code on a white card with a white quiet zone |
| Small print under 2 cm | Black on white, error correction H |
| Logo in the center of the symbol | Black on white or 7:1+ pairing, error correction H |
How to Customize Colors Safely in Our Generator
In the QR generator's style panel, set the module color and background color separately (Step 4 of the QR code generation guide), then check the built-in contrast indicator before downloading. Rules of thumb: keep the ratio at 7:1 or better; if the background is branded (not white), keep modules near-black; and always download at the size you will print, because color fidelity at 300 DPI differs from what the screen shows. For logos, combine a custom color scheme with a raised error-correction level — see our QR error correction guide for how the recovery budget works.