Color Contrast for Accessibility: WCAG Ratios Explained with Examples
Low contrast is one of the most common accessibility failures on the web, and one of the easiest to fix once you know the numbers.
The numbers to remember
| Element | AA (usual target) | AAA |
|---|---|---|
| Normal text | 4.5 : 1 | 7 : 1 |
| Large text (≥ 24 px, or ≥ 18.66 px bold) | 3 : 1 | 4.5 : 1 |
| UI components and meaningful graphics | 3 : 1 | n/a |
These come from the Web Content Accessibility Guidelines (WCAG) 2.2 success criteria 1.4.3 (Contrast Minimum), 1.4.6 (Enhanced) and 1.4.11 (Non-text Contrast). Contrast ratios range from 1:1 (identical colours) to 21:1 (black on white).
How the ratio is calculated
Each colour is converted to a relative luminance L between 0 (black) and 1 (white), taking into account how the eye perceives red, green and blue differently. The ratio is (Llighter + 0.05) ÷ (Ldarker + 0.05). You do not need to do this by hand: the colour tool’s contrast checker shows the ratio and pass or fail for each level.
A useful fact: mid-grey #767676 on white is the lightest grey that just passes the 4.5:1 requirement for normal text. Anything lighter, which is very common for placeholder or caption text, fails.
Fixing failing colours
- Keep the hue, and change lightness. Convert to HSL and lower the lightness for text on a light background (or raise it for dark mode).
- Darken the text rather than lightening the background if the brand colour is the background.
- For buttons, ensure the label meets 4.5:1 against the button colour, and the button meets 3:1 against the page.
- Re-test after each change.
The colour tool’s HSL values and shade generator make it easy to step through lighter and darker versions of the same colour.
More than contrast ratios
- Do not rely on colour alone to convey meaning (for example red for errors). Add an icon or text.
- Check states: hover, focus, disabled and visited links need adequate contrast too, and focus indicators should be clearly visible.
- Text over images: use an overlay or a solid panel so contrast holds on every part of the picture.
- Dark mode: re-test, because colours that pass on white may fail on dark backgrounds.
- Colour blindness: avoid red/green as the only distinction.
Worked examples
| Text colour | Background | Ratio (approx.) | Normal text AA? |
|---|---|---|---|
| #000000 | #FFFFFF | 21 : 1 | Pass |
| #767676 | #FFFFFF | 4.5 : 1 | Pass (just) |
| #999999 | #FFFFFF | 2.8 : 1 | Fail |
| #FFFFFF | #3498DB | about 3.2 : 1 | Fail for normal text; passes for large text |
The last row matters for this very site’s blue: white text on a mid-blue button passes the 3:1 threshold for large or bold UI text but not the 4.5:1 requirement for small body text, so use a darker blue for small text.
How to test a page quickly
- List your text and background colour pairs (body, headings, links, buttons, placeholders, captions).
- Enter each pair into the contrast checker.
- Fix failures by darkening text or lightening backgrounds, keeping hue.
- Check hover, focus and disabled states and dark mode separately.
- Test with a browser’s built-in accessibility inspector and, where possible, with real users.
Why it matters beyond compliance
Good contrast helps people with low vision, anyone reading in bright sunlight, and older readers, and it makes pages easier to read for everyone. Accessibility is also a legal or procurement requirement in some contexts.
Try it now: Color Picker
Free, private and runs in your browser. Nothing is uploaded.
Open Color PickerFrequently asked questions
Sources and further reading
- W3C: Understanding Success Criterion 1.4.3 Contrast (Minimum)
- W3C: Understanding Success Criterion 1.4.11 Non-text Contrast
External links open the original source. We cite primary or official documentation for factual claims and re-check them when we update an article. See our editorial policy.
Keep reading
- QR Code Best Practices: How to Make One That ScansMake QR codes that scan every time: static vs dynamic, error correction, quiet zone, contrast, size, print tips and staying safe from malicious codes.
- Aspect Ratios Explained: How to Choose and Crop to the Right OneWhat aspect ratio means, the most common ratios and where they are used, plus simple maths for cropping any photo to the ratio you need without distortion.
- How to Write AI Image Prompts: A Practical FrameworkA framework for writing AI image prompts that work in Midjourney, Stable Diffusion and DALL·E: subject, style, lighting, camera, negatives, iteration.