Low contrast text is the most common accessibility failure on the web. Pale grey text on white looks elegant in a design file and becomes unreadable on a phone in sunlight, on an old monitor, or for anyone with reduced vision. The fix is usually a small change to a few colours.
What a contrast ratio is
WCAG measures contrast as a ratio between the lightness of two colours. The scale runs from 1 to 1, which is the same colour on itself, to 21 to 1, which is black on white. The higher the number, the easier the text is to read.
The numbers to remember
| Content | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5 to 1 | 7 to 1 |
| Large text (about 24 px, or about 19 px bold, and larger) | 3 to 1 | 4.5 to 1 |
| Icons, form field borders, focus outlines, chart parts | 3 to 1 | No AAA level |
The text rule is success criterion 1.4.3. The rule for icons and controls, 1.4.11, arrived with WCAG 2.1.
What is exempt
- Logos and brand names
- Disabled buttons and fields
- Text that is pure decoration or part of a photo where it is not the point of the image
Where contrast usually fails
- Light grey body text and footers
- Placeholder text inside form fields
- White text on a bright brand colour, especially yellow, orange and light blue
- Text placed over photographs
- Links that differ from the surrounding text by colour alone
How to test
- Open your browser's developer tools and inspect a piece of text. Chrome, Edge and Firefox show the contrast ratio in the colour picker.
- Use a free contrast checker and enter the foreground and background colour codes.
- Run an automated checker over the page to find the worst cases quickly, then check text over images by eye, because tools cannot judge those.
How to fix
Darken the text before you touch the background. Moving a grey from #999999 (2.8 to 1 on white) to #767676 (4.5 to 1) is hard to notice in the design and makes the text pass. For text over photos, add a solid or semi-transparent panel behind the words. For links inside paragraphs, keep the underline.
Do not rely on colour alone
About 1 in 12 men and 1 in 200 women have some form of colour vision deficiency. Error messages, required fields and chart series need a second signal, such as an icon, a text label or a pattern, in addition to the colour.
What the widget adds
Some visitors need more contrast than any brand palette offers, and some need less brightness. The free ADA Okay! widget gives them Dark High Contrast, Bright High Contrast and Monochrome modes to choose from. Those modes are a personal setting for each visitor. Your default colours still need to meet the ratios above.