QRAnalytica

What Colors Can a QR Code Be and Still Scan?

QR code colors can be almost anything if the squares are much darker than the background. Avoid red, orange, yellow, pastels and inverted designs.

Nookesh Karri · 8 min read
Dark cover card with the title 'What Colors Can a QR Code Be and Still Scan?' in white and a lime accent bar

A QR code can be almost any color as long as the squares are clearly darker than the background. Navy, forest green, purple or charcoal on white or cream scan well. Yellow, orange, pastels and light blue on white often fail, and so do red codes at shop tills.

Scanners don’t see hue the way you do. They see light and dark. Below are common QR code colors with real hex values and the contrast each pair produces.

Why QR code colors come down to contrast

QR code colors only matter through contrast: the scanner has to tell the dark squares from the light ones. Barcode scanners detect differences in light reflectance between dark and light areas, and too little difference stops the decode.

In the QR standard, a dark module represents a binary one and a light module a zero. So the scanner’s real job is sorting every square into one of two buckets. Many scanning libraries convert a colored code to grayscale before they do anything else.

That conversion is why a vivid color can still fail. Bright yellow looks bold to you, but in grayscale it lands close to white.

Which colors scan well and which fail?

Dark, saturated colors on white or cream scan well, and light or warm colors fail. I ran common brand colors through the W3C relative luminance formula and the contrast ratio formula, which scores any color pair from 1:1 (identical) to 21:1 (black on white).

Code colorBackgroundContrast ratioVerdict
Black #000000White21:1Best possible
Navy #1B2A4AWhite14.2:1Safe
Navy #1B2A4ACream #FFF8E113.4:1Safe
Purple #7B1FA2White8.2:1Safe
Forest green #1B5E20White7.9:1Safe
Red #D32F2FWhite5.0:1Phones yes, tills risky
Light blue #00A3E0White2.9:1Risky
Orange #FF8C00White2.3:1Avoid
Yellow #FFD600White1.4:1Avoid

There is no official minimum contrast number for QR codes. As a working floor, I borrow the web accessibility rule that text needs at least 4.5:1. For print that lives outdoors or under dim light, I aim for 7:1 or more, the same level WCAG picked to cover reduced contrast sensitivity.

The red trap: passing the contrast check and still failing

Red is the one color where a good contrast score can mislead you. In the table above, red on white scores 5.0:1, which clears the text rule. Yet barcode standards bodies tell you to avoid it.

The reason is the light source. Most barcode scanners use red illumination, including retail point-of-sale scanners. Red, orange and yellow ink reflect red light, so they can look effectively invisible to that scanner even when a phone reads the same code fine. GS1 UK says plainly to avoid red or orange for the dark elements.

A real example: a café prints a red loyalty QR code on its receipts. Customers scan it with their phones without trouble. Then staff try to scan returned receipts on the counter’s red-light imager, and nothing happens. If any scanner other than a phone camera will ever read your code, skip red.

Can a QR code be inverted (light on dark)?

An inverted QR code, light squares on a dark background, is allowed by the standard but not read by every scanner. The definition says symbols are intended to be read either dark on light or light on dark, a case called reflectance reversal.

Support in practice is patchy. A maintainer of the ZXing scanning library wrote that inverted QR codes are not a part of the required spec and that checking every frame for them would waste half of all the CPU time consumed. GS1 UK also advises against reversing colors for codes likely to be scanned at tills.

My take: don’t invert a code unless the design can’t work any other way. If you must, test it on every phone you can borrow. A white code on a black poster looks sharp, but you can’t choose which scanner app your customer opens.

Gradients, backgrounds and the quiet zone

Gradients, busy backgrounds and colored borders cause as many failures as bad color picks. GS1’s guidance lists colour gradients within the barcode symbol among the things to avoid, along with pastel modules, metallic or glossy inks, and decorative backgrounds that blur the edges.

If you still want a gradient, keep both ends of it dark. A navy-to-purple gradient on white stays well above the safe range. A navy-to-sky-blue gradient fades into the background at the light end.

The quiet zone is the blank margin around the code. It is 4 modules wide on all four sides, and its reflectance should match the light squares. GS1 support says it is safest to keep the quiet zone the same colour as the code’s background. So a cream code on a cream card works, but a dark brand frame pressed right against the code does not.

Surface matters too. Failures also come from reflective backgrounds, poor lighting and direct sunlight. A matte finish beats gloss for the same colors. Our guide on printing QR codes covers paper and finish choices.

How to check your QR code colors before printing

Checking takes a few minutes and saves a reprint.

  1. Look up the hex values of your code color and background in your design tool.
  2. Calculate the contrast ratio with any WCAG contrast checker. Aim for 7:1 or higher, and never go under 4.5:1.
  3. Rule out red, orange and yellow for the dark squares if any non-phone scanner might read the code.
  4. Check the quiet zone matches the background color on all four sides.
  5. Print one proof at the real size and scan it with an iPhone and an Android phone, in the light where it will hang.

Our free QR validator flags low color contrast in a QR image and checks the link for hijacking before you print. QRAnalytica’s generator also lets you set colors, gradients and eye patterns, so you can adjust and re-check in one place.

The limitation: the validator looks at the image, not the physical print. It can’t tell you how a red-light till scanner will see your ink, or whether glossy lamination will glare. Only the printed test answers that. If scanning still fails, our QR code not scanning guide walks through size, file and phone issues, and the QR code size guide covers distance.

Adding a logo on top of colored squares stacks two risks. Read how to put a logo in the middle of a QR code before combining them, and if you’re torn between two designs, you can A/B test QR code designs with real scans.

FAQ

Can a QR code be any color?

Almost. The squares need to be much darker than the background. Navy, dark green, purple and charcoal on white or cream all work. Yellow, orange, pastels and light blue on white usually don’t.

Can a QR code be white on a black background?

The standard allows light-on-dark codes, but some scanner libraries skip them to save processing time. Keep dark squares on a light background unless you can test on many phones.

Why does my red QR code scan on my phone but not at the till?

Many retail and industrial scanners light the code with red light. Red ink reflects red light, so the squares can look almost the same as the background to that scanner.

Can a QR code have a gradient?

It can, but barcode standards bodies advise against gradients inside the symbol. If you use one, keep every part of the gradient dark and test the printed code.

What color should the border around a QR code be?

The same color as the code’s light background. The quiet zone around the code should match the light squares, so a colored frame right up against the code can confuse scanners.

Sources

Track your dynamic campaigns. 7-day trial, no credit card.
Generate Dynamic QR