Color contrast checker (WCAG 2.2)

WCAG 2.2 asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text at level AA, and 7:1 and 4.5:1 at AAA. Enter a text and a background color to get their ratio, the levels they pass, and the nearest text shade that would pass if they don't.

HEX, 3 or 6 digits

HEX, 3 or 6 digits

Contrast ratio

4.54:1

#767676 on #FFFFFF

Large text at 24 px

Normal body text at 16 px, the size most paragraphs use.

Button border
  • Pass · AA · normal textSC 1.4.3, at least 4.5:1
  • Pass · AA · large textSC 1.4.3, at least 3:1 (24 px, or 18.5 px bold)
  • Fail · AAA · normal textSC 1.4.6, at least 7:1
  • Pass · AAA · large textSC 1.4.6, at least 4.5:1
  • Pass · AA · icons and UI bordersSC 1.4.11, at least 3:1 against adjacent colors
Nearest text color for 7:1
#5959597.00:1 on #FFFFFF
  • This passes AA by a whisker. Anti-aliasing, thin fonts and screen glare make text near 4.5:1 harder to read than the number suggests.

How is the contrast ratio calculated?

WCAG compares how bright two colors look using their relative luminance: each sRGB channel is linearised (values at or below 0.04045 are divided by 12.92, the rest raised to the power 2.4), then weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue, because the eye is most sensitive to green.

The ratio is the lighter luminance plus 0.05 divided by the darker plus 0.05, so it runs from 1:1 (identical colors) to 21:1 (black on white). The 0.05 stands in for the glare a real screen adds.

Results are never rounded before they are compared: 4.499:1 fails a 4.5:1 requirement. That is why this checker cuts the displayed ratio to two decimals instead of rounding it up. When a pair fails, it walks the text color's lightness, keeping the hue, to the nearest shade that passes.

L = 0.2126 R + 0.7152 G + 0.0722 B   (linearised sRGB)
ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05)

Which gray text colors pass on white and on black?

Contrast of common grays against #FFFFFF and #000000 (WCAG 2.2 AA normal text needs 4.5:1)
GrayOn whiteAA on whiteOn blackAA on black
#00000021.00:1pass1.00:1fail
#33333312.63:1pass1.66:1fail
#5555557.45:1pass2.81:1fail
#5959597.00:1pass2.99:1fail
#6666665.74:1pass3.65:1fail
#7070704.95:1pass4.24:1fail
#7676764.54:1pass4.62:1pass
#7777774.47:1fail4.68:1pass
#8888883.54:1fail5.92:1pass
#9494943.03:1fail6.92:1pass
#AAAAAA2.32:1fail9.03:1pass

How to check color contrast for WCAG

  1. 1
    Enter the text colorPick it with the color picker or type its HEX code, such as #767676.
  2. 2
    Enter the background colorUse the color directly behind the text, not the page's overall background if a card or button sits between them.
  3. 3
    Read the levelsThe checker shows the ratio and whether it passes AA and AAA for normal and large text, and the 3:1 rule for icons and borders.
  4. 4
    Take the suggested shade if it failsCopy the nearest passing text color, which keeps your hue and changes only its lightness.

Frequently asked questions

What contrast ratio does WCAG AA require?
4.5:1 for normal text and 3:1 for large text under Success Criterion 1.4.3. Large text means at least 18 point (about 24 px), or 14 point (about 18.5 px) when bold.
Is #767676 on white accessible?
Yes, just: #767676 on #FFFFFF is 4.54:1, which passes AA for normal text. One step lighter, #777777, is 4.47:1 and fails.
Do logos and disabled buttons need to meet contrast rules?
No. WCAG exempts text in logos and brand names, and text in inactive interface components, from SC 1.4.3. Disabled controls still need to be recognisable as controls.
Does contrast apply to icons and input borders?
Yes. Success Criterion 1.4.11 asks for at least 3:1 between meaningful icons, form-field borders or focus indicators and the colors next to them.
Why does my design tool show a slightly different ratio?
Some tools round the ratio, and older ones still use the pre-2021 0.03928 threshold in the luminance formula. WCAG says that change has no practical effect, but rounding can turn a failing 4.49:1 into a displayed 4.5:1.

Sources

Related tools

See all 73 free tools

Need this, but tailored to your brand?

We design UI, UX, and interfaces that feel as good as they look.

Built by CountryDevs · No signup · No ads · We count visits, never what you enter