WCAG contrast requirements
| Check | Minimum ratio |
|---|---|
| AA normal text | 4.5:1 |
| AA large text | 3:1 |
| AAA normal text | 7:1 |
| AAA large text | 4.5:1 |
| UI components and graphics | 3:1 |
Large text means at least 24px (18pt), or 18.66px (14pt) if bold. UI components covers things like input borders, focus rings, icons and chart lines that people need to see to use the page. Text in logos and disabled controls is exempt.
Greys on white
| Grey | Ratio on white | Passes |
|---|---|---|
#959595 | 2.99:1 | Nothing |
#767676 | 4.54:1 | AA |
#595959 | 7.00:1 | AAA |
#3d3d3d | 10.86:1 | AAA |
Getting to a pass
When a pair fails, the checker suggests the closest text colour that passes, and the closest background colour, by changing only lightness in OKLCH. The hue and colourfulness stay the same, so your brand colour still looks like your brand colour, just a bit darker or lighter. Apply a suggestion with one click, and undo it if you change your mind.
Traps the checker warns about
- Rounding: a ratio between 4.45 and 4.5 shows as “4.5” in tools that round, but fails. The ratio here is always rounded down.
- Transparency:
rgba(0 0 0 / 50%)text has a very different contrast on white than on grey. It’s blended before measuring. - Placeholder text must meet 4.5:1 too, if it carries information.
- Text on images or gradients needs to pass against the lightest part behind it.
How the ratio is worked out
ratio = (L1 + 0.05) / (L2 + 0.05)
L = 0.2126 R + 0.7152 G + 0.0722 B (relative luminance, linear RGB)
L1 is the lighter colour, L2 the darkerThe ratio runs from 1:1 (identical colours) to 21:1 (black on white). Green contributes most to perceived brightness and blue least, which is why pure blue text on black is so hard to read.
Need a colour in another format? Use the colour converter.
Questions people ask
What contrast ratio do I need?
My ratio is 4.49:1. Does that pass?
What’s the lightest grey I can use on white?
#767676, at 4.54:1, is the lightest grey that passes AA for normal text on white. #777777 just fails.