How to check colour contrast against WCAG
Contrast ratio is a number between 1:1 and 21:1 derived from the relative luminance of two colours. WCAG 2 sets four thresholds: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1. Those are the numbers an auditor will check, and they are the numbers a low-vision reader feels.
Enter your text colour and your background colour and this checker computes the ratio and tells you which of the four thresholds you clear, live, in your browser.
- Enter the foreground (text) colour as a hex value, or use the colour picker.
- Enter the background colour the same way.
- Read the ratio and the four pass or fail badges: AA normal (4.5:1), AA large (3:1), AAA normal (7:1), AAA large (4.5:1).
- Use Swap colours to check the inverse pairing, which is common for dark mode.
- Darken the foreground or lighten the background until the badge you need turns green.