# Contrast ratio

> Contrast ratio is the luminance difference between a QR code's dark and light modules. Decoders need a clear threshold; the practical floor is about 40% luminance difference, and colour choice matters far less than luminance choice.

Source: https://useqr.app/glossary/contrast-ratio · Last reviewed 2026-08-21 · UseQR is free forever, MIT licensed, no signup.

---

## Luminance, not hue

A decoder converts the image to greyscale before thresholding. Two colours that look
strongly different to a human — a mid red on a mid green — can have nearly identical
luminance and produce a code no scanner can read.

Compute relative luminance and compare. Anything under roughly a 40% difference is risky;
under 30% will fail on most cameras in ordinary light.

## Dark on light, not light on dark

The specification assumes dark modules on a light background. Many decoders handle inverted
codes, but not all, and phone cameras are inconsistent about it. An inverted code is a
gamble for no design benefit.

## Real-world derating

Contrast measured on screen is the best case. Printing on uncoated stock, laminating,
scanning under warm restaurant lighting, and photographing at an angle all reduce effective
contrast. Leave headroom — a code that is marginal on screen fails in the room.

UseQR's [validator](/validate) computes the actual luminance contrast of your chosen
colours and decodes the rendered output rather than guessing.
