About the Contrast Checker
Contrast Checker calculates the contrast ratio between a foreground (text) color and a background color using the WCAG formula, then tells you which accessibility levels the pair meets. A live sample shows the actual text on the actual background, so you can judge readability with your own eyes too.
How it works
Each color's red, green and blue values are converted from the 0-255 range to 0-1, linearized with the sRGB gamma curve, and combined into relative luminance as 0.2126 R + 0.7152 G + 0.0722 B. Green gets the largest weight because human eyes are most sensitive to it.
That ratio is compared with the WCAG 2 thresholds: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1, and non-text elements such as icons and input borders need 3:1. The ratio is truncated, not rounded, so 4.499 is never shown as passing. When a level fails, the tool finds the closest passing colors by changing only the lightness of the text or background color.
How to use
- 1
Pick or type the text color (hex, rgb() or hsl()).
- 2
Pick or type the background color, or click the swap button to reverse them.
- 3
Check the ratio and the preview of large, normal and small text, a button and a link.
- 4
Read the five pass or fail tiles, and click a suggested color to fix a failing pair.
Worked examples
Blue link on white
A site uses #2563EB for links on a white page.
5.17 clears the 4.5 bar for AA body text but not the 7.0 bar for AAA.
Gray that just misses
A designer uses mid-gray #777777 for captions.
One step darker, #767676, gives 4.54:1 and passes AA for normal text.
White text on a brand blue button
A button uses white text on #3B82F6.
Fine for large, bold button labels, but too low for small text; a darker blue would fix it.
Frequently asked questions
What contrast ratio do I need to pass WCAG AA?+
At least 4.5:1 for normal text and 3:1 for large text.
What's the difference between WCAG AA and AAA?+
AAA is stricter: 7:1 for normal text and 4.5:1 for large text. AA is the level most laws and accessibility policies require; AAA is a higher target for content where readability is critical.
Does it matter which color is foreground and which is background?+
Not for the ratio itself, which is the same either way. It matters for the suggested fixes, which change the text color or the background separately.
What is the highest possible contrast ratio?+
21:1, which is pure black (#000000) against pure white (#FFFFFF).
Why does the ratio use + 0.05?+
The 0.05 represents ambient light reflecting off the screen. It keeps the ratio finite for pure black and reflects that real screens are never perfectly dark.