WCAG Color Contrast Explained: AA, AAA and How the Ratio Works
If you have ever had a design rejected because a light grey failed an accessibility audit, you have met the WCAG contrast ratio. It is one of the few design rules that is precise, measurable and, in many countries, legally relevant. The good news is that it is easy to understand once you know what the numbers mean.
Why contrast matters
Low contrast text is hard to read for people with low vision, for older users (contrast sensitivity declines with age), for anyone on a phone in bright sunlight, and on cheap or poorly calibrated screens. The World Health Organization estimates that at least 2.2 billion people have some form of near or distance vision impairment. Good contrast helps all of them, and it costs nothing.
The Web Content Accessibility Guidelines (WCAG), published by the W3C, set measurable minimums. WCAG 2.1 and 2.2 are referenced by laws and procurement rules such as the European Accessibility Act, EN 301 549 in the EU, and Section 508 in the United States (which references WCAG 2.0 AA). In the US, courts have also cited WCAG in ADA cases.
The numbers you need to know
| Requirement | Level | Minimum ratio | Applies to |
|---|---|---|---|
| 1.4.3 Contrast (Minimum) | AA | 4.5:1 | Normal text |
| 1.4.3 Contrast (Minimum) | AA | 3:1 | Large text |
| 1.4.6 Contrast (Enhanced) | AAA | 7:1 | Normal text |
| 1.4.6 Contrast (Enhanced) | AAA | 4.5:1 | Large text |
| 1.4.11 Non-text Contrast | AA | 3:1 | UI components and graphics |
Most organisations aim for level AA. AAA is a good target for long-form reading, such as articles and documentation, but is not usually required for an entire site.
What counts as large text?
WCAG defines large text as at least 18 point regular or 14 point bold. In CSS pixels, that is about 24px regular or 18.66px bold. Everything smaller is normal text and needs the higher ratio. This is why a 16px grey caption can fail while the same color in a 32px heading passes.
Font weight matters: very thin weights look lighter than their color suggests, so treat light (300) and thin (100–200) fonts with extra caution even when they technically pass.
How the ratio is calculated
The contrast ratio compares the relative luminance of two colors. Relative luminance is a measure of perceived brightness from 0 (black) to 1 (white). To calculate it:
- Convert each RGB channel from 0–255 to 0–1.
- “Linearise” each channel to undo the gamma encoding of sRGB. Small values are divided by 12.92; larger values use the formula ((v + 0.055) / 1.055)^2.4.
- Weight the channels: L = 0.2126 R + 0.7152 G + 0.0722 B. Green has the biggest weight because our eyes are most sensitive to it.
The ratio is then (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color. The 0.05 accounts for ambient light reflecting off the screen. The result ranges from 1:1 (identical colors) to 21:1 (black on white).
You do not need to do this by hand. The contrast checker above calculates it instantly and shows the pass or fail result for each level.
Surprising results
Because of the green weighting, colors of the same HSL lightness can have very different contrast. Pure yellow (#FFFF00) on white has a ratio of about 1.07:1, nearly invisible, while pure blue (#0000FF) on white reaches about 8.6:1. Mid-tone oranges and greens are the colors that most often fail on white backgrounds.
Another surprise: white text on a medium blue or orange button often fails AA for normal-sized text. Many brand colors were picked for logos, not for button labels.
Non-text contrast (1.4.11)
Since WCAG 2.1, interface components need 3:1 contrast too. This includes the borders of text inputs, checkboxes and radio buttons, focus indicators, and meaningful icons or chart lines. A pale grey input border on white (a popular look) usually fails. Disabled controls are exempt, as are logos and purely decorative graphics.
How to fix failing colors
Darken or lighten one color. Usually you adjust the text color and keep the background. Changing only the HSL lightness preserves the hue, so the color still feels on-brand. The “Fix text for AA” button in our checker does exactly this, searching for the closest lightness that passes.
Use different shades for different jobs. Keep your bright brand color for large surfaces and illustrations, and create a darker shade specifically for text and small buttons. A color scale generator gives you those shades systematically.
Increase size or weight. If a color must stay as it is, making text large enough to qualify as “large text” lowers the requirement to 3:1.
Add an outline or overlay. For text on photos, add a semi-transparent dark overlay or a solid panel behind the text so contrast is guaranteed no matter what the photo shows.
What contrast checks don’t cover
The WCAG ratio is a useful minimum, not a guarantee of readability. It doesn’t account for font size beyond the large/normal split, for very thin fonts, or for colors that pass but still vibrate, like saturated red text on blue. It also can’t tell you whether meaning is conveyed by color alone, which is a separate requirement (1.4.1 Use of Color). For that, test with a color blindness simulator and add icons or labels where needed.
A newer method called APCA (Advanced Perceptual Contrast Algorithm) has been developed as a candidate for future guidelines. It accounts for font size and weight and for the fact that light text on dark backgrounds behaves differently. It is not part of WCAG 2.x, so for compliance today, use the classic ratio.
A practical workflow
- Define text and background pairs early in your design system, not page by page.
- Check every pair once and document the ratio next to the tokens.
- Use the darker shade of each brand color for text and links.
- Check UI borders and focus rings for 3:1.
- Re-check whenever the palette changes.