Color contrast for websites: a practical guide
Updated:
Low contrast is the most common accessibility problem on the web, and it makes pages harder to read for everyone — on a phone in sunlight, on an old monitor, or with tired eyes.
1. What a contrast ratio is
Contrast ratio compares the lightness of two colors, from 1:1 (identical) to 21:1 (black on white). It depends on lightness, not hue — a red and a green of similar lightness can have very low contrast.
2. The numbers to remember (WCAG 2)
- Normal text: at least 4.5:1 (level AA), 7:1 for level AAA.
- Large text (about 24px, or 18.66px bold, and up): at least 3:1 (AA), 4.5:1 (AAA).
- Buttons, input borders, icons and other UI parts: at least 3:1 against what surrounds them.
3. Where contrast usually fails
- Light gray text for captions, dates and placeholders.
- White text on bright brand-colored buttons such as yellow, light green or orange.
- Text placed over photos or gradients.
- Disabled-looking buttons that are actually active.
4. Fix lightness, keep the hue
You rarely need a different color to fix contrast. Make the text or button a bit darker (or lighter on dark backgrounds) while keeping the same hue. The brand still feels the same, and the text becomes readable.
5. Don't rely on color alone
Links inside text should have an underline or another visual cue, and error messages should include text or an icon, not just a red border. About one in twelve men has some form of color vision deficiency.
6. Check it automatically
TonePatch measures the text on any page you load, lists elements with low contrast, and keeps text readable automatically when it applies a new palette.