Color contrast is one of the most measurable, objective aspects of web accessibility — and one of the most commonly failed. WCAG 2.1 defines precise numerical thresholds that tell you whether a text-and-background combination is accessible. Understanding those thresholds, and why they exist, is foundational for any developer or designer building for the web.
What Is Contrast Ratio?
Contrast ratio is a number that describes how much a foreground color (typically text) stands out against a background color. The WCAG formula produces a value between 1:1 (identical colors — zero contrast) and 21:1 (pure black on pure white — maximum contrast).
The formula uses relative luminance — a measure of how light or dark a color appears to the human eye, accounting for the fact that the eye is more sensitive to green than red or blue.
Contrast Ratio = (L1 + 0.05) / (L2 + 0.05)
Where L1 is the relative luminance of the lighter color and L2 is the relative luminance of the darker color.
Relative luminance itself is calculated from the RGB values by linearizing each channel:
L = 0.2126 × R + 0.7152 × G + 0.0722 × B
(where R, G, B are the linearized channel values in the 0–1 range)
You don't need to calculate this by hand — our free Color Contrast Checker computes it in real time as you adjust colors.
The Two WCAG Levels: AA vs AAA
WCAG 2.1 defines contrast requirements at two conformance levels. Here's the full table:
| Check | AA Threshold | AAA Threshold |
|---|---|---|
| Normal text (< 18px regular, < 14px bold) | 4.5:1 | 7:1 |
| Large text (≥ 18px regular, or ≥ 14px bold) | 3:1 | 4.5:1 |
| UI components & graphics | 3:1 | — |
| Decorative text | No requirement | No requirement |

What counts as "large text"?
Under WCAG 2.1 Success Criterion 1.4.3, large text is:
- 18px or larger at normal weight
- 14px or larger at bold weight (700+)
This threshold exists because larger text is easier to read even at lower contrast, which is why the standard allows a relaxed ratio.
What are UI components and graphics?
This is WCAG 1.4.11 (Non-text Contrast), introduced in WCAG 2.1. It applies to:
- Input borders (text fields, checkboxes, radio buttons)
- Focus indicators
- Chart lines and data points
- Icon-only buttons
A checkbox border that blends into the background fails 1.4.11 even if all your text passes 1.4.3.
AA vs AAA: Which Should You Target?
AA is the legal minimum in most jurisdictions
WCAG Level AA is required by:
- ADA (US — Section 508 for federal, implied for public-facing)
- EN 301 549 (EU)
- AODA (Canada — Ontario)
- EAA (EU — European Accessibility Act, enforcement starts 2025)
Most accessibility audits, legal settlements, and compliance certificates are written against AA. This is your baseline — meeting AA should be non-negotiable.
AAA is a quality target, not always achievable everywhere
AAA (7:1 for normal text) is a significant jump. Black (#000000) on white (#ffffff) gives you 21:1 — well above AAA. But many brand color palettes use mid-range hues (medium blues, greens, purples) that simply can't reach 7:1 against white without becoming so dark they lose their hue character.
WCAG explicitly acknowledges this: the spec says "It is not possible to satisfy all Level AAA Success Criteria for some content." AAA is aspirational for high-stakes interfaces (medical, government, emergency services) and any interface serving users with significant vision loss.
Practical guidance:
- Body text, long-form content: aim for AAA (7:1) where your palette allows
- UI labels, form fields, navigation: minimum AA (4.5:1)
- Large decorative headings: at minimum AA for large text (3:1), ideally higher
- Brand colors used for text: check each combination explicitly — don't assume
Common Contrast Failures and Why They Happen
1. Gray-on-gray placeholder text
Placeholder text in <input> fields is notoriously low-contrast. Most browsers default to something around 40–50% gray, which fails AA against a white background. CSS custom properties make this easy to fix:
::placeholder {
color: #6b7280; /* Passes AA: 4.6:1 on white */
}
2. Disabled UI elements
WCAG explicitly exempts "inactive user interface components" from contrast requirements (SC 1.4.3 note). This is often misread as a blanket pass for any disabled element. In practice, visually disabled controls that provide zero affordance about what action they represent are a usability failure even if they're a legal pass. Use low contrast intentionally for truly disabled states, but ensure users can still understand what the disabled control is.
3. Text over images or gradients
When text sits on a photo or gradient, there's no single contrast value — it varies across the image. Solutions:
- Add a semi-transparent dark scrim behind the text
- Use a solid text shadow with enough opacity
- Constrain text to a region with predictable color
Test multiple points across the image. The worst-case contrast must pass.
4. Focus ring color
The default browser focus ring (typically a blue or black outline) can fail contrast against certain page backgrounds. WCAG 2.2 adds SC 2.4.11 (Focus Appearance), requiring focus indicators to have a minimum area and contrast. Check your focus ring against both the element background and the ring's adjacent color.
Quick Reference: Contrast Ratios for Common Color Pairs
| Foreground | Background | Ratio | AA Normal | AAA Normal |
|---|---|---|---|---|
| #000000 (black) | #ffffff (white) | 21:1 | Pass | Pass |
| #1e293b (slate-900) | #ffffff | 16.7:1 | Pass | Pass |
| #6b7280 (gray-500) | #ffffff | 4.6:1 | Pass | Fail |
| #9ca3af (gray-400) | #ffffff | 2.85:1 | Fail | Fail |
| #3b82f6 (blue-500) | #ffffff | 3.0:1 | Fail (normal) | Fail |
| #1d4ed8 (blue-700) | #ffffff | 7.8:1 | Pass | Pass |
| #7c3aed (violet-700) | #ffffff | 6.1:1 | Pass | Fail |
| #ffffff | #1e293b (slate-900) | 16.7:1 | Pass | Pass |
The blue-500 case is the most commonly failed brand color. Medium blues fail 4.5:1 on white. You either need a darker shade (blue-700 or darker) or a dark background.
How to Use a Contrast Checker
Instead of calculating ratios manually, use a real-time tool. Our FocusFlow Color Contrast Checker accepts hex codes for both background and text, shows the ratio instantly, and displays pass/fail badges for all four WCAG checks (AA normal, AA large, AAA normal, AAA large).
It also generates smart color suggestions — if your current combination fails, it recommends variants that pass, derived from your chosen hue so they stay on-brand.
For a step-by-step walkthrough of how to integrate contrast checking into your design workflow, see our How to Check Color Contrast for Accessibility guide.
Summary
| AA | AAA | |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text (18px+ or 14px+ bold) | 3:1 | 4.5:1 |
| UI components & graphics | 3:1 | — |
| Legal requirement (most jurisdictions) | Yes | No |
| Achievable for all color combinations | Yes | No — exempt where impossible |
AA is the floor. AAA is where you should push when the palette allows. And the only way to know for sure is to measure.