Color Contrast Checker

Check text-vs-background contrast against WCAG AA & AAA — with a live preview.

Runs in your browserUpdated Built and maintained by Leon and Henrik

Pick a text and background color to see the contrast ratio and WCAG pass/fail. Free. No sign-up. Runs in your browser, nothing is uploaded.

Color Contrast Checker

Text color

Background

Almost before we knew it

we had left the ground — the quick brown fox jumps over the lazy dog.

Contrast ratio17.96:1
Normal text · AAPass
Normal text · AAAPass
Large text · AAPass
Large text · AAAPass
Runs in your browser
Nothing is uploaded

Set a text color and a background, by picker or by typing a hex code, and the checker shows the contrast ratio, a live preview with sample text, and a pass or fail for each of the four WCAG levels: normal and large text, AA and AAA. Ratios run from 1:1 (same color) to 21:1 (black on white).

The four WCAG thresholds

LevelNormal textLarge text (24 px, or 18.66 px bold)
AA4.5:13:1
AAA7:14.5:1

The same 3:1 also applies, under WCAG 2.1, to non-text elements people need to see: input borders, focus rings, icons that carry meaning and chart lines. Placeholder text in a form field is text, so it needs 4.5:1 if it says something important.

Which grey text passes on white?

Light grey on white is the most common contrast failure on the web. Here are the ratios:

Text colorOn white #FFFFFFOn light grey #F5F5F5
#5959597.00:1 (AAA)6.42:1 (AA)
#6666665.74:1 (AA)5.26:1 (AA)
#7676764.54:1 (AA)4.16:1 (large only)
#7777774.47:1 (large only)4.10:1 (large only)
#8888883.54:1 (large only)3.25:1 (large only)
#9999992.84:1 (fails)2.61:1 (fails)
#AAAAAA2.32:1 (fails)2.13:1 (fails)

#767676 is the lightest neutral grey that passes AA on pure white, and it already fails on a slightly grey card. One hex step lighter, #777777, fails. If your design uses tinted background panels, check the text against the panel, not the page.

Button colors: white text or black text?

Brand colors often look strong but fail with white labels. Ratios for some popular UI colors:

Button colorWhite textBlack text
Blue #2563EB5.16:14.06:1
Blue #007BFF3.97:15.27:1
Red #DC26264.82:14.34:1
Pure red #FF00003.99:15.25:1
Green #16A34A3.29:16.37:1
Orange #F973162.80:17.49:1
Purple #7C3AED5.69:13.68:1

Mid-tone greens and oranges almost never work with white text at normal size. You have three options: darken the button until white passes, switch to dark text (orange with black text clears even AAA), or keep the color only for large text such as a big hero button.

How the ratio is calculated

Each color's relative luminance is computed with the WCAG formula: the red, green and blue channels are converted from sRGB to linear light, then weighted 21.26% red, 71.52% green and 7.22% blue, because the eye is far more sensitive to green. The ratio is then

(lighter luminance + 0.05) ÷ (darker luminance + 0.05)

The 0.05 accounts for ambient light reflected off a screen. It's also why white on black reaches 21:1 and not infinity.

Contrast isn't the whole story

  • Hue alone isn't enough. A red and a green can have a perfectly fine contrast ratio against white and still be confused with each other by people with red-green color blindness. Check that separately with the Color Blindness Simulator.
  • Thin fonts read weaker. A light 300-weight font at 4.6:1 is harder to read than a regular weight at the same ratio. The formula doesn't see font weight, so give thin type extra margin.
  • Text on images changes from pixel to pixel. Check the lightest part of the image behind the text, or put a solid or semi-opaque layer under the text.

If your colors come as RGB or HSL, convert them to hex first with the Color Converter. If a brand color fails, the Color Shade Generator gives you darker and lighter steps of the same hue to test here until one passes.

Frequently asked questions

Related tools

All Color tools →