Skip to content

Design & Media3 min read

How to Check Color Contrast for Free

Pale grey text looks refined on a designer's screen and disappears on everyone else's. Here is how to check a colour pair properly, and what the numbers mean.

KLYRO TeamPublished

klyro / tools / contrast-checkerIn your browserTEXT COLOUR#0A0F1ABACKGROUND#FFFFFF19.6:1Contrast ratioAA normalPassAAA normalPassAA largePassAAA largePassSample text at 16px on this pairThe quick brown fox jumps over the lazy dog.Smaller supporting text, same pair.

Contrast is the difference in brightness between text and the colour behind it. Too little of it and the text is hard work to read, particularly on a phone outdoors, on a cheap screen, or for anyone whose eyesight is not perfect.

The accessibility guidelines put a number on it. A contrast ratio is a single figure between 1:1 and 21:1, and there are thresholds you either meet or do not.

What the numbers mean

There are two levels and two text sizes, which gives four results for any pair.

ThresholdApplies toLevel
4.5:1Normal text, under about 18.5pxAA
3:1Large text, from about 18.5px bold or 24px regularAA
7:1Normal textAAA
4.5:1Large textAAA
AA is the level most organisations are held to. AAA is the stricter one.

Large text gets an easier threshold because size does some of the work that contrast otherwise has to. That is also why a heading can use a colour that would fail underneath it in body copy.

How to check a pair

  1. Enter the two colours

    Type hex values, or use the colour pickers. The order matters only for readability; the ratio is the same either way round.

  2. Read the ratio, then the four results

    The ratio is the fact. The four pass or fail results are what it means for the size and level you are working to.

  3. Look at the live sample

    The preview shows real text at both sizes on the pair you entered. A number can pass and still be uncomfortable; the sample is the reality check.

4.7:1Contrast ratioNormal textAAPassNormal textAAAFailLarge textAAPassLarge textAAAPassSample at 16pxBody copy at this pair passes AA but not AAA.Small print at the same pair is harder work than it needs to be.
One ratio, four verdicts. This pair passes AA for body copy and not AAA.

When a pair fails

The usual fix is to darken the text rather than change the background, because a background is normally load-bearing in a design and a text colour rarely is.

The Klyro checker can find the nearest passing colour for you. It walks the same hue towards the threshold and then re-checks the result after rounding to 8-bit values, so it never offers a colour that passes in theory and fails once your browser has it.

NEAREST PASSING COLOUR#8A93A34.7:1 AA fail#6B73835.1:1 AA passThe suggestion is re-checked after rounding, so it never offers a pass it cannot show.
A small step down in lightness is usually all it takes.

Common mistakes

  • Judging by eye on a good screen. A calibrated display in a dim room flatters everything. The number does not.
  • Testing the heading and not the caption. Small print is where contrast problems actually live.
  • Placing text over a photograph. The ratio changes across the image. Either put the text on a solid panel, or add an overlay dark enough that the worst part of the photo still passes.
  • Using colour alone to carry meaning. A red border that means "error" tells nothing to somebody who cannot distinguish it. Write the word as well.
  • Forgetting disabled and placeholder text. It is meant to look secondary, not to be invisible.

Questions

What ratio should I aim for?
4.5:1 for body text is the level most organisations work to. If you can reach 7:1 without the design suffering, take it — nobody has ever complained that text was too easy to read.
Does this apply to logos and icons?
Logos are exempt from the text rules. Icons that carry meaning on their own should still reach 3:1 against their background so they can be made out.
Is the ratio calculated exactly?
Yes. It uses the official WCAG relative luminance formula rather than an approximation, and the suggested colours are re-checked after rounding.