Light grey text on a white background might look minimal and elegant in a design file. For many of the people who visit your site, it is a struggle to read. Color contrast is one of the simplest parts of accessibility to get right, and one of the most often missed. Year after year, automated audits of the web’s most popular home pages find low-contrast text to be the most common accessibility error.
Why contrast matters
Good contrast helps far more people than you might expect:
- People with low vision. Hundreds of millions of people worldwide live with a vision impairment, and many more have age-related changes. Most people’s contrast sensitivity starts to decline in their 40s.
- People with color vision deficiency. Roughly 1 in 12 men and 1 in 200 women have some form of color blindness.
- Everyone in difficult conditions. Bright sunlight on a phone, a dim laptop screen to save battery, or a cheap projector all wash out low-contrast colors.
- Your business. Text that is easier to read gets read. Accessibility is also a legal requirement in many countries for public sector sites and, increasingly, for private businesses.
What the contrast ratio means
Contrast is expressed as a ratio between the lighter and the darker of two colors, from 1:1 (no contrast, the same color) to 21:1 (black on white). It measures difference in brightness, not hue. Red text on a green background can have very poor contrast even though the hues are opposites, if both colors are similarly bright.
WCAG contrast requirements
The Web Content Accessibility Guidelines (WCAG) are published by the W3C and are the basis of most accessibility laws and policies. Version 2.2 is the current recommendation. It defines two levels for contrast:
| Criterion | Applies to | Minimum ratio |
|---|---|---|
| 1.4.3 Contrast (Minimum), AA | Normal text | 4.5:1 |
| 1.4.3 Contrast (Minimum), AA | Large text | 3:1 |
| 1.4.6 Contrast (Enhanced), AAA | Normal text | 7:1 |
| 1.4.6 Contrast (Enhanced), AAA | Large text | 4.5:1 |
| 1.4.11 Non-text Contrast, AA | UI components and meaningful graphics | 3:1 |
Large text means at least 18 point (24 CSS pixels) at regular weight, or at least 14 point (about 18.66 CSS pixels) in bold. Larger letters stay readable at lower contrast, which is why the threshold is lower.
Non-text contrast covers things like the border of a text input, the outline of a checkbox, a focus indicator, or the lines in a chart. If a user needs to see it to understand or operate the page, it needs 3:1 against the colors next to it.
There are exceptions: logos, disabled controls, purely decorative text, and text that is part of a photo don’t have to meet these ratios.
How the contrast ratio is calculated
The ratio is based on relative luminance, a measure of how bright a color appears to the human eye. Calculating it takes three steps.
1. Convert each RGB channel to linear light
Screen colors are stored with gamma encoding, so first divide each channel by 255, then convert to a linear value:
if (c <= 0.03928) linear = c / 12.92
else linear = ((c + 0.055) / 1.055) ^ 2.42. Weight the channels
Our eyes are most sensitive to green and least to blue, so the channels are weighted:
L = 0.2126 × R + 0.7152 × G + 0.0722 × BThis explains why pure yellow (#FFFF00) is so much brighter than pure blue (#0000FF) even though both have one channel at zero. Yellow uses red and green, which make up 93% of perceived brightness.
3. Compare the two luminances
ratio = (L_lighter + 0.05) / (L_darker + 0.05)The 0.05 added to each side accounts for ambient light reflecting off the screen and stops the ratio from becoming infinite with pure black.
Our contrast checker does all of this instantly and suggests a passing alternative if your colors fail.
Real-world examples
Brand colors are where contrast problems usually appear. Here are some typical cases against a white background:
| Color | Ratio on white | Verdict |
|---|---|---|
#FF8800 Bright orange | 2.39:1 | Fails even for large text. Use as a background with dark text, or darken it. |
#B35F00 Darkened orange | 4.61:1 | Passes AA for all text while still reading as orange. |
#22C55E Bright green | 2.28:1 | Fails. Common for “success” messages. |
#15803D Darker green | 5.02:1 | Passes AA. |
#1A73E8 Typical link blue | 4.51:1 | Passes AA, only just. |
#333333 Charcoal | 12.63:1 | Excellent body text color, softer than pure black. |
Yellows, oranges, light greens and cyans are the hardest hues to use as text on white, because they are inherently bright. Blues, purples and reds have much more room before they fail.
How to fix colors that fail
- Adjust lightness, not hue. Darken the foreground (or lighten the background) using HSL lightness. The color still reads as the same hue, so it stays on-brand.
- Create a text version of your brand color. Many design systems define a bright brand color for fills and a darker variant specifically for text and links.
- Flip the relationship. If an orange fails as text on white, use it as a button background with very dark text on top.
- Make it bigger. If a color only reaches 3:1, reserve it for large headings.
- Add a scrim behind text on images. A semi-transparent dark gradient behind white text guarantees contrast whatever the photo shows.
Beyond contrast ratios
- Don’t use color as the only signal. WCAG criterion 1.4.1 says information must not be conveyed by color alone. Underline links within text, add icons to error messages, and label chart lines directly.
- Avoid problem pairs. Red/green, green/brown and blue/purple are hard to distinguish for many people with color vision deficiency.
- Mind very high contrast too. Pure white on pure black can cause a “halation” glow for some readers, including many people with astigmatism. Slightly off-white on very dark grey is often more comfortable for long reading.
- Test dark mode separately. A palette that passes in light mode won’t automatically pass when inverted.
What about WCAG 3 and APCA?
The WCAG 2 formula is simple and widely adopted, but it has known weaknesses. It tends to overstate the contrast of dark color pairs and understate some light ones, and it ignores font weight beyond a simple large-text threshold. The Accessible Perceptual Contrast Algorithm (APCA) is being developed as a candidate for the future WCAG 3 and models perception more accurately.
WCAG 3 is still a draft, so for compliance today use the WCAG 2 ratios. Designs that comfortably pass WCAG 2 AA, rather than scraping past at 4.5:1, will almost always do well under future methods too.
Ready to check your colors? Open the contrast checker, or pick colors from an image first.