Why contrast matters
Text that looks fine to you can be unreadable for someone with low vision, ageing eyes or a glare-filled screen. The Web Content Accessibility Guidelines define minimum contrast ratios so your content stays legible for everyone.
The rules to remember
| Level | Normal text | Large text |
|---|---|---|
| AA | 4.5 to 1 | 3 to 1 |
| AAA | 7 to 1 | 4.5 to 1 |
Large text means 18pt regular or 14pt bold. Buttons, labels and captions count as normal text, so hold them to 4.5 to 1 even when they look big.
How the ratio is calculated
Each colour is converted to relative luminance using the sRGB formula, then the lighter and darker values are compared as (L1 + 0.05) / (L2 + 0.05). Because the lighter value is always the numerator, the result is the same whichever colour is the text.
Check any pair instantly
Enter your foreground and background hex codes in the WCAG Color Contrast Checker to see the ratio and the pass or fail result for AA and AAA. Try swapping the colours if you are unsure which is the text.
Fixing a failing pair
- Darken or lighten the text towards the extremes.
- Adjust the background rather than the brand colour.
- Use a slightly stronger shade from the same palette.
- Increase font weight or size where the rules allow large text.
Find colours to work with
Pull a palette from an existing image with the Color Palette Extractor, then convert between hex, RGB and HSL with the Color Converter. Testing each pairing as you design avoids accessibility fixes later.
Make it a habit
Contrast checking takes seconds and prevents a whole class of complaints and legal risk. Bake it into your design review so no low-contrast text ships by accident.