Skip to content

WCAG colour contrast, explained

· 9 min read

Colour contrast is the most frequently failed accessibility check on the web, and the easiest to fix once you know the rules. Those rules are short: two or three ratios, a definition of "large text", and a handful of places people forget to look. This guide covers all of it, including the arithmetic behind the number, so a failing result stops being a mystery.

What the contrast ratio measures

WCAG compares the relative luminance of two colours — how bright each one appears, weighted the way human eyes perceive red, green and blue. The ratio runs from 1:1 (identical colours) to 21:1 (black on white), and it ignores hue entirely: a red and a green of the same luminance score 1:1 against each other, however different they look to most people.

The calculation, for each colour:

  1. Divide each sRGB channel by 255, then linearise it: values up to 0.04045 are divided by 12.92; anything above becomes ((c + 0.055) / 1.055)^2.4.
  2. Combine the channels: L = 0.2126 R + 0.7152 G + 0.0722 B. Green dominates, which is why a pure blue looks darker than a pure green of the same intensity.
  3. Compare the lighter luminance with the darker one: (L_light + 0.05) / (L_dark + 0.05).

The +0.05 models the glare of a real screen, and it is why contrast can never be infinite. You never need to do this by hand — the contrast checker runs it live as you change colours — but knowing the formula explains results that look wrong, like orange text that seems perfectly readable failing badly.

The ratios you actually need

WhatLevel AALevel AAA
Normal text4.5:17:1
Large text (24px, or 18.66px bold)3:14.5:1
Icons, form borders, focus indicators, chart elements3:1—

Text contrast comes from success criterion 1.4.3 (AA) and 1.4.6 (AAA). The third row is 1.4.11 Non-text Contrast, added in WCAG 2.1 and the one most often missed. "Large" is defined in points — 18pt, or 14pt bold — which works out to 24 CSS pixels, or about 18.66px bold.

AA is the level that matters in practice. It is what most accessibility laws and procurement rules point to; EN 301 549, the standard behind EU accessibility requirements, references WCAG level AA. AAA is worth reaching for in long-form reading and for audiences with low vision, but WCAG itself does not recommend requiring it site-wide.

No rounding

A ratio of 4.49:1 fails AA. The thresholds are exact. This catches a lot of greys: on a white background, #767676 scores 4.54:1 and passes, while #777777 — one step lighter — scores 4.48:1 and fails. Some familiar colours, measured on white:

Colour on whiteRatioNormal text AA
#595959 dark grey7.00:1Passes (and AAA)
#767676 grey4.54:1Passes
#777777 grey4.48:1Fails
#0000FF pure blue8.59:1Passes
#FF0000 pure red4.00:1Fails (large text only)
#FFA500 orange1.97:1Fails everything
#9CA3AF a popular "muted" grey2.54:1Fails everything

The cases audits keep catching

Body text in a design system usually passes. Failures hide in the states and corners nobody put in the mockup:

  • Placeholder text. It is text, and 1.4.3 applies to it. The light grey most form libraries ship with typically lands around 2.5:1. If the placeholder carries information, it has to pass — or move that information into a visible label.
  • Focus indicators. A focus ring must reach 3:1 against what surrounds it. A subtle glow on a white page often doesn't, which leaves keyboard users unable to see where they are.
  • Form field borders. If the border is the only thing showing where an input is, it needs 3:1. Hairline grey borders are the classic failure.
  • Text over images. Check the worst spot — the lightest part of the photo behind white text — not the average. A scrim (a semi-transparent dark overlay) is the reliable fix.
  • Transparency. Text at 60% opacity has the contrast of the colour it renders as, blended with the background. Measure the blended result, not the CSS value.
  • Hover, pressed and visited states. Each state is its own colour pair and each has to pass.
  • Dark mode. A separate set of pairs. Light grey on near-black can fail just as easily as the reverse.
  • Links identified only by colour. Under 1.4.1 (Use of Color), a link inside body text needs either an underline or another cue, or at least 3:1 against the surrounding text plus a non-colour indication on hover and focus.

Two exemptions are worth knowing so you don't over-correct: disabled controls that cannot be used, and logos or text that is purely decorative or part of a brand mark. A greyed-out "Submit" button that genuinely does nothing does not have to pass.

Fixing a pair that fails

Change lightness, not hue. Keep the brand colour's hue and saturation and darken it until the ratio clears 4.5:1 — Tailwind's green-600 (#16A34A) scores 3.30:1 on white and fails, while green-700 (#15803D) scores 5.02:1 and passes, and they read as the same green. When a light brand colour has to stay as it is, use it for large headings or backgrounds behind dark text rather than for body copy.

Never rely on colour alone to carry meaning either — a red border for an error needs an icon or a message too, because about one in twelve men has some form of colour vision deficiency, and contrast ratios say nothing about hue.

What about WCAG 3 and APCA?

Drafts of WCAG 3 explore a different contrast model, APCA, which accounts for font weight and polarity. It is not a standard yet and nothing legally requires it. WCAG 2.2 — the ratios above — is the version audits, laws and contracts use today.

Checking your colours

The contrast checker takes two colours, shows the ratio, marks which AA and AAA levels pass for normal and large text, and previews the pair rendered as real text. It runs in your browser with nothing sent anywhere, which matters when the palette belongs to a product that hasn't launched yet. If your colours come in another notation, the colour converter translates between HEX, RGB and HSL.