Colour Contrast: Making Text Readable for Everyone
What the contrast ratio means, which targets to hit, and how to fix a palette that fails.
Light grey text on white looks elegant in a mock-up and is painful on a phone in sunlight. Contrast is the difference that decides whether people can read what you wrote.
The numbers
The Web Content Accessibility Guidelines measure contrast as a ratio from 1:1 (no difference) to 21:1 (black on white). Normal text should reach at least 4.5:1 to pass level AA. Large text, which is about 24 pixels or 19 pixels bold, needs 3:1. For the stricter AAA level, the targets are 7:1 and 4.5:1.
Test it
Paste your text and background colours into the colour contrast checker. It shows the ratio and tells you which levels pass, with a live preview so you can see it.
Fixing a failing pair
- Darken the text, rather than lightening the background. Small steps are enough.
- Make a scale of shades from your brand colour with the shades generator and pick the darker step for text.
- Do not rely on colour alone to show meaning. Add an icon or a label for errors and success.
Converting between formats
Your designer may hand you HSL and your stylesheet wants HEX. The colour converter handles all of them. For a whole palette that already works together, try the palette generator.