In this article
What contrast ratio means
Contrast ratio compares the brightness (relative luminance) of two colours, from 1:1 (identical) to 21:1 (black on white). The Web Content Accessibility Guidelines (WCAG) set minimums so text is readable for people with low vision – and comfortable for everyone else, especially outdoors on phones.
The targets
| Content | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5 : 1 | 7 : 1 |
| Large text (18 pt / 24 px, or 14 pt / about 18.7 px bold) | 3 : 1 | 4.5 : 1 |
| Icons, input borders, button outlines | 3 : 1 | – |
AA is the level most organisations and many laws aim for.
Check a colour
- Open the Color Converter and enter a colour in HEX, RGB or HSL.
- See its contrast ratio with white and with black.
- Look at the row of lighter and darker shades and pick one that meets the target.
- Copy the values as HEX, RGB, HSL, HSV or CMYK.
Fixing a brand colour that fails
Many bright brand colours – orange, yellow, light green, sky blue – do not reach 4.5:1 with white text. You do not need to change the brand. Use:
- the original colour for large elements (big buttons, headings, backgrounds behind dark text),
- a darker shade of the same hue for small text and links,
- dark text instead of white on light brand colours.
Keeping the hue and changing only lightness – easy in HSL – preserves the brand feel.
Common contrast mistakes
- Grey placeholder text in forms that people mistake for filled-in values.
- Text on photos – add a dark overlay or a solid band behind the text.
- Colour alone to show meaning, like red for errors – add an icon or words for colour-blind users.
- Dark mode afterthoughts – check contrast in both themes.
Colour formats in brief
HEX and RGB describe colours for screens; HSL is easiest for creating variations; HSV/HSB is what many design apps show; CMYK describes ink for printing. Screen-to-print conversion is approximate – printers use colour profiles, so ask for a proof for important print jobs.
Testing with real people and devices
Numbers are a guide, not the whole story. Look at your pages on a cheap phone outdoors, with screen brightness low, and ask someone older or with glasses to read them. Browser developer tools can also simulate colour blindness – useful for checking charts and status colours.
Building a small palette
From one brand colour, pick: a dark shade for text and links, the brand colour for buttons, a very light tint for backgrounds and highlights, and neutral greys. Store them as CSS variables so the whole site stays consistent. To get the exact colour from a logo, use the Image Color Picker; for the tab icon, match it in the Favicon Generator.