Color contrast checker
WCAG contrast ratio between a text colour and a background, with AA and AAA pass or fail.
Runs entirely in your browser. Your files never leave your device.
About this tool
Light grey text on white looks elegant on a designer’s screen and unreadable on a phone in the sun. The Web Content Accessibility Guidelines measure readability with a contrast ratio, from 1:1 for identical colours to 21:1 for black on white. Pick a text colour and a background, or paste hex or rgb() codes, and see the ratio with a live sample.
The results tell you at once which WCAG 2 levels pass. Level AA, the usual legal and contractual target, needs 4.5:1 for body text and 3:1 for large text and for interface parts such as button borders and icons. Level AAA asks for 7:1 and 4.5:1. Ratios are truncated, never rounded up, so a borderline colour is not shown as passing.
How it works
- Pick or paste the text colour.
- Pick or paste the background colour.
- Read the ratio and the AA and AAA results.
- Adjust until the levels you need pass.
Ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 and L2 are the relative luminances of the lighter and darker colours, computed from linearised sRGB channels.
Worked example
Grey text #777777 on white has a ratio of 4.48:1: it just misses AA for body text, which needs 4.5:1. Darken it one notch to #767676 and the ratio becomes 4.54:1, a pass that looks the same to most eyes.
White text on a #3B82F6 blue button reaches about 3.7:1: fine for large bold text, too low for small labels. A darker blue such as #2563EB passes 4.5:1.
Good to know
- Test the real pairs of your design, including placeholders, disabled states and text over images.
- Large text means at least 24 px regular or about 18.7 px bold.
- Contrast is not the only cue: links and errors should not rely on colour alone.