How to check a whole page for WCAG colour contrast
A plain guide to the rules, the numbers, and where checks go wrong
Low-contrast text is the most common accessibility failure on the web. The WebAIM Million, a yearly automated survey of the top million home pages, has found it on more than four pages in five, every year it has run. It is also one of the few failures a machine can measure exactly, which makes it the best place to start.
What WCAG 2.2 requires
- Body text: 4.5 to 1 against its background, for Level AA (success criterion 1.4.3).
- Large text: 3 to 1. Large means at least 24 pixels, or at least 18.66 pixels and bold.
- Level AAA: 7 to 1 for body text and 4.5 to 1 for large text (1.4.6).
- Controls and graphics: 3 to 1 for the boundary of an input, a button with no fill, and icons that carry meaning (1.4.11).
A ratio is not rounded up. Text at 4.49 to 1 fails, even though most tools print it as 4.5.
What is exempt
- Text that is part of a logo.
- Disabled controls and their labels.
- Text that is hidden, or pure decoration.
Placeholder text is not exempt. Neither is text in a footer, or small print.
Why checking one pair at a time misses most failures
A colour-pair checker answers a question about two colours you typed in. A page does not have two colours. The colour that reaches the eye depends on things a stylesheet does not show at a glance:
- Transparency. A translucent label on a translucent card on a coloured page has a background that is none of the three.
- Opacity on a parent. Text inside a faded container is paler than its declared colour.
- Dark mode. A page can pass in one theme and fail in the other.
- Components. Text inside web components and embedded frames is still text on your page.
- Images and gradients. Text over a photograph has no single background colour. No tool can measure it honestly; a person has to look.
How to check a whole page
- Measure what is painted, not what is declared. Resolve every text node against the layers actually behind it.
- Check both themes if the site has them.
- Check states you can reach: open the menu, the dialog and the form with its errors showing, then check again.
- Keep the uncertain cases separate. Text over an image is a manual check, not a failure and not a pass.
- Fix by moving lightness, not hue. The nearest passing colour usually keeps the brand colour recognisable.
Doing it in one click
Contrast Auditor is a browser extension for Chrome and Edge that does the above for the page you are looking at: every text node, control boundaries and icons, both criteria levels, with the uncertain cases listed apart. It runs entirely in your browser and sends nothing anywhere. The free tier shows the true count and the first ten issues in full; a one-time Pro licence adds a suggested fix for each failure and a client-ready report.
An automated check is an aid, not a certificate. Passing contrast says nothing about the rest of WCAG, and a full audit needs a person.