Printed a code and need to change the link? QR Gen makes codes you can edit later.Edit codes after printing with QR Gen.See QR Gen

Open on your phone

QR code colors that still scan, with the contrast numbers

Which QR code colors scan and which fail? We tested grey ramps, brand pairs, inverted codes and gradients on two decoders. Pick a safe pair here.

Your QR code colors can be almost anything as long as the dots are clearly darker than the background. Aim for a contrast ratio of 5 to 1 or better, never go below 3 to 1, and don’t bother with hue: a scanner sees how light or dark each square is, not whether it’s red or teal. We tested that claim on a set of greys and brand-style pairs, and the numbers below show where each one starts to fail.

Most colour advice on the web is a list of “good” and “bad” swatches with no test behind it. This one is built from codes we drew and decoded ourselves, so you can see the cliff edge instead of taking a rule on trust.

How much contrast is enough

Contrast ratio is the same measure web designers use for text. The W3C’s accessibility guidelines define it as (L1 + 0.05) / (L2 + 0.05), where L1 and L2 are the relative luminance of the lighter and darker colour. Pure black on white scores 21 to 1. Our generator uses the same formula in its Colours tab, and warns you below 3 to 1.

To find out where that warning should sit, we drew the same link as a QR code, https://example.com/menu, with grey dots on a white background at nine different contrast levels. Each code was made small (4 pixels per square), blurred slightly and sprinkled with random noise, the way a phone camera in a dim shop would see it. We ran 40 different noise patterns per row through two decoders: jsQR, the open-source decoder our scanner falls back on, and the QR detector built into Chrome on macOS.

Dot colour on white Contrast jsQR (of 40) Chrome detector (of 40)
#d3d3d3 1.5 to 1 0 20
#b7b7b7 2.0 to 1 11 40
#a4a4a4 2.5 to 1 19 40
#959595 3.0 to 1 32 40
#898989 3.5 to 1 34 40
#7f7f7f 4.0 to 1 38 40
#6f6f6f 5.0 to 1 40 40
#595959 7.0 to 1 40 40

Two lessons. The stricter decoder starts dropping codes at 4 to 1 and fails most of them below 2.5 to 1, so a code that “works on my phone” can still fail on someone else’s older handset or a shop’s cheap counter scanner. And 3 to 1 is a floor, not a target: at 3 to 1, jsQR missed 8 of 40. From 5 to 1 upward nothing failed. Design for the strict decoder.

Hue doesn’t count, lightness does

We repeated the test with named pairs, all on the same code and the same noise.

Dots on background Contrast jsQR (of 40) Chrome detector (of 40)
Black on white 21.0 to 1 40 40
Navy #1a237e on white 13.2 to 1 40 40
Navy #1a237e on pale yellow #fff59d 11.9 to 1 40 40
Dark green #1b5e20 on white 7.9 to 1 40 40
Red #e53935 on white 4.2 to 1 40 40
Orange #fb8c00 on white 2.4 to 1 33 40
Blue #1565c0 on orange #ef6c00 1.9 to 1 0 40
Yellow #fdd835 on white 1.4 to 1 0 21
Red #c62828 on green #2e7d32 1.1 to 1 0 0

Blue on orange looks loud and clear to a person and is invisible to jsQR, because the two have almost the same lightness. Red on green fails everywhere for the same reason, and it’s also the classic trap for people with red-green colour blindness. If you choose pairs that differ strongly in lightness, you cover both problems at once: dark navy on pale yellow looks distinct to nearly everyone and scans at 11.9 to 1.

GS1 UK’s colour guidance says black on white is the most reliable combination, and adds a warning we’d repeat: avoid red and orange as the dark colour, because many scanners use red light and may not pick those colours up. Our orange row at 2.4 to 1 shows the other side of it: all 40 on the lenient detector, but 7 misses on the strict one.

Inverted codes: white on dark

White dots on a navy background, 13.2 to 1, is plenty of contrast. It still failed in one place. jsQR read 0 of 40 when told to look only for dark dots on light, and 40 of 40 when it also tried the inverted version. Chrome’s detector read all 40.

So an inverted code is not broken, but it depends on the scanner trying both ways, and not every scanner does. This site’s scanner does. The generator warns “some older scanners cannot read that way round” when you pick light dots on a dark background. GS1 UK goes further: it advises against reversing the colours, because traditional till scanners don’t read inverted barcodes, a real risk if the code might be scanned at a checkout. Denso Wave, who invented the code, puts it plainly in its FAQ: print black on a white background.

Our view: print dark on light unless the design really needs the inversion, and then keep a plain version for places where you can’t control the scanner.

Gradients and photographs behind the code

Contrast has to hold at the weakest spot, not on average. We drew black dots over a background that fades from white on the left to grey on the right, and measured the contrast at the dark end.

Background fades to Contrast at the dark end jsQR (of 40)
#aaaaaa 9.0 to 1 40
#8c8c8c 6.2 to 1 40
#6e6e6e 4.1 to 1 38
#505050 2.6 to 1 25

The same 3 to 1 cliff shows up. A photo or a gradient behind a code is fine only if its darkest patch is still a lot lighter than the dots. If the picture is busy, put the code on a plain white or light tile, as you would with a logo (the logo guide covers that).

See-through backgrounds count too

The generator can export a PNG or SVG with a see-through background. That is handy for a coloured sign, but the paper behind the code becomes the background colour, and the contrast that matters is dots against that paper. A black code on a see-through background looks fine on white card and falls apart on dark blue card. If the sign is not light and plain, leave the white background switched on and let the code sit on its own white tile. The same goes for the white border: it is part of the code, so don’t crop it away (the size guide explains the four-square margin).

Check your own pair in thirty seconds

You don’t need a lab. Pick the two colours in the Colours tab and read the message under the swatches: it warns below 3 to 1 and flags light dots on a dark background. Then take a photo of the screen, or of your printed proof, and switch the photo to black and white in your phone’s editor. If you can still see the code clearly as grey squares, a scanner will too. If the squares melt into the background in grey, they will melt for the scanner. Do it once at arm’s length and once from where a customer would stand.

Printing it right

Colours on screen and on paper are different animals. Two print points:

  • Screens mix light (RGB) and printers mix ink (CMYK), so the two never match exactly. Judge contrast on a printed proof, not on the preview.
  • For plain black dots, ask for 100% black only. A printer’s help page, Tradeprint’s guide to black, recommends C0 M0 Y0 K100 for black text and fine lines because a mix of four inks can look fuzzy when the plates sit slightly out of line. QR squares are fine detail, so the same logic holds.

Pairs we’d print

All of these passed 40 out of 40 on both decoders in our noise test:

  • Black on white (21.0 to 1) for anything that might be scanned at a till.
  • Navy #1a237e on white (13.2 to 1) when you want a hint of brand colour.
  • Dark green #1b5e20 on white (7.9 to 1).
  • Navy #1a237e on pale yellow #fff59d (11.9 to 1) when the sign has a coloured background.

Pick one in the generator’s Colours tab, read the contrast message under the swatches, and still scan a print of it with the scanner on your oldest phone. The main guide to making a QR code lists the other settings worth checking, and QR code not scanning? 12 causes and fixes is where to go when a printed code fails.

Ready to try it? Free, no sign-up, made in your browser.

Open the QR generator