CodeBox Hub
FREE

QR Code Colors: What Actually Scans

Which QR code colors actually scan? Contrast ratios, 8 tested combinations, the dark-on-light rule, and how to customize colors safely.

# 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:

ModuleBackgroundContrast1st-try successVerdict
#000000#FFFFFF21:130/30Reference
#1A237E#FFFFFF14.2:130/30Safe
#004D40#FFFFFF12.9:130/30Safe
#B71C1C#FFFFFF6.9:130/30Safe
#3366CC#FFFFFF6.4:129/30Safe
#666666#FFFFFF5.8:128/30OK, avoid for small codes
#000000#F5F5F517.6:130/30Safe (off-white bg)
#FFFFFF#00000021:10/30Fails — 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

SituationSafe 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 requirementPut the code on a white card with a white quiet zone
Small print under 2 cmBlack on white, error correction H
Logo in the center of the symbolBlack 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.

FAQ

Can a QR code be any color I want?

Any color pair with enough contrast and the right direction — dark modules, light background. The code has no brand color in its spec; scanners read luminance difference, so "any color" is really "any high-contrast pair."

Why does a white QR code on a dark background not scan?

Because most decoders reject light-on-dark candidates during the detection stage — the camera's exposure locks onto the bright area. The contrast ratio is high; the direction is wrong. Put the code on a white card or a white quiet zone instead.

What contrast ratio should I target?

7:1 or higher, the WCAG AAA bar for large graphics. 4.5:1 is the practical minimum for large codes on new phones; below 3:1 stop — the combination will fail in the field.

Can I use my brand color as the background?

Yes, if the modules stay near-black or you swap to a light module color on a light card. Test the actual printed result, not the screen: ink and paper shift luminance by 5 to 10%.

Do colored QR codes scan as fast as black ones?

On modern phones, yes — a 7:1+ colored code failed zero times in our 30-scan test. On older hardware, black-on-white remains the only pair we would guarantee.

Is a gradient background safe for QR codes?

No. Gradients change the local background luminance, so the effective contrast varies across the symbol. Use a flat color, or place a solid light card behind the code.

Does adding a logo require a different color rule?

The logo — added in the QR beautifier — eats into the error-correction budget, so keep the module/background contrast at 7:1+ and raise the error-correction level to H. Color plus logo is fine; color plus logo on a low-contrast pair is not.

How do I check the contrast ratio of my chosen colors?

Convert both hex values to relative luminance (WCAG formula) and divide lighter by darker. The generator's style panel shows this live, and any WCAG contrast checker works — just treat the QR as "large text" and aim for the AAA column.

Keep reading

Contact us