BFCBrilliance

How to Check Colour Contrast Properly

Pure blue text on white passes AAA. Pure green fails everything. Green carries ten times blue's weight in the WCAG formula, and it shows.

By BFCBrilliance··4 min read

The ratio, and where it comes from

WCAG contrast isn't a rough guide. It's a defined calculation, and it's worth knowing what it actually does to your colours.

Each channel goes from 0–255 to a 0–1 value, then gets linearised — at or below 0.04045 it's divided by 12.92, above that it becomes ((value + 0.055) / 1.055) raised to the power 2.4. Those linear channels are then weighted:

0.2126 red · 0.7152 green · 0.0722 blue

That gives relative luminance. The ratio is (lighter + 0.05) / (darker + 0.05).

Your details

0 to 255. The classic #767676 grey is 118, 118, 118.

255, 255, 255 is white.

Result

Contrast ratio
4.54

Runs from 1 (identical) to 21 (black on white). Nothing can exceed 21.

Headroom over AA body text (4.5:1)NEGATIVE means it fails. Shown as a difference rather than a ratio so rounding can never turn a near miss into a pass.
0.04
Headroom over AA large text (3:1)Negative means it fails. Large is 18pt, or 14pt bold.
1.54
Headroom over AAA body text (7:1)Negative means it fails the strictest level.
-2.46
Black text on this background would give
21
White text on this background would give
1
Best you can do on this backgroundThe better of plain black or plain white. If this misses your threshold, the BACKGROUND has to change.
21
Relative luminance - text
0.1812
Relative luminance - background
1

Open the Colour Contrast Ratio Calculator on its own page to bookmark or share it.

Three landmarks tell you an implementation is right: black on white gives exactly 21, identical colours give exactly 1, and the classic #767676 grey on white gives 4.54.

Green does almost all the work

Look at those weights again. Green is 0.7152, blue is 0.0722 — nearly ten times less.

You can watch it in the tool. Set the text to each pure primary and its relative luminance comes back as exactly its own coefficient:

Pure colour on whiteRelative luminanceContrast
Blue0.07228.59:1 — passes AAA
Red0.21264.00:1 — fails AA body
Green0.71521.37:1 — fails everything

Three fully saturated primaries, and the spread runs from comfortably AAA to unreadable. This is why nudging the blue channel of a colour barely moves its score while a small change to green moves it a lot — and why two colours that look about equally dark can land on opposite sides of a threshold.

Four thresholds, three numbers

LevelBody textLarge text
AA4.5:13:1
AAA7:14.5:1

AAA-large and AA-body are the same threshold. Clearing 4.5:1 means you satisfy AA for body text and AAA for large text at once.

Large means at least 18 point, or 14 point bold — roughly 24px and 18.5px at the standard 1pt = 1.333px conversion. Bold is the only place font weight enters the standard, and it buys you the easier threshold at a smaller size.

Why headroom, not a tick

Here's the case that decides it. Two greys on white:

  • #7676764.54:1, headroom +0.04. Passes.
  • #7777774.48:1, headroom −0.02. Fails.

One value on each channel. Now express those as a proportion of the 4.5 threshold: 1.01 and 0.995 — and the second one rounds to 1.00, which reads exactly like a pass.

That's why the tool reports a signed difference. The sign can't round into a lie, and it tells you how much room you have, which a tick never does.

Check the ceiling before you start nudging

Plain black or plain white is almost always the highest contrast available against any given background. So those two outputs bracket what's achievable before you adjust anything.

On a mid-grey #808080 background:

  • Black text → 5.32:1
  • White text → 3.95:1
  • Best available → 5.32:1

Which means AAA body text is impossible on mid-grey. No text colour gets there. If you need 7:1, the background has to change — and knowing that at the start saves three rounds of adjusting the wrong thing.

Meeting the number is a floor

The ratio clears a bar. It doesn't make text readable on its own.

It says nothing about typeface or letter spacing, nothing about font size beyond the large-text threshold, and — importantly — nothing about colour vision deficiency. Two colours can meet 4.5:1 and still be hard to tell apart for someone with common colour blindness, because the ratio only compares lightness.

It also assumes a flat background. Text over a photograph or a gradient needs checking at its worst point, not its average, and that point usually isn't where you'd look first.

The ones people forget

When you check a palette, the main body text is rarely the problem. The failures cluster in:

  • Placeholder and hint text — almost always the worst thing on the page.
  • Disabled states, which are deliberately faint and still need to be perceivable.
  • Link colours, which need checking against the background and against the body text around them.
  • Focus and hover states, not just the resting state.

The printable has a table for working through pairs, because doing them one at a time in a browser tab is how three of them get missed.

Free tool

Colour Contrast Ratio Calculator

The WCAG contrast ratio for any two colours, checked against all four thresholds - plus whether plain black or white text would do better.

Open the tool →
#tech#accessibility#wcag#design#colour

Enjoyed this? Get the next one.

New articles straight to your inbox. No spam, ever.

Keep reading

Tech

How Far Should You Sit From Your TV?

Two different questions with two different answers — and at 4K they stopped agreeing. At nine feet you can go from a 69-inch screen to a 138-inch one.

Aug 3, 2026 · 4 min read