Understanding Color Contrast and WCAG Accessibility
Color contrast is the difference in perceived brightness between two colors. WCAG requires a minimum ratio of 4.5:1 for normal text. Here's how to test and fix contrast issues.

In this article expand_more
- What Is Color Contrast?
- WCAG Contrast Requirements
- How Contrast Ratio Is Calculated
- Common Contrast Failures and How to Fix Them
- Gray text on white backgrounds
- Blue links on colored backgrounds
- White text on light brand colors
- Placeholder text in forms
- Testing Contrast in Your Design Workflow
- During design (Figma / Sketch)
- During development (browser)
- Automated testing
- Color Blindness: Beyond Contrast
- Frequently Asked Questions
- Does the contrast ratio apply to decorative images?
- Do I need AAA compliance?
- What about dark mode?
What Is Color Contrast?
Color contrast is the difference in relative luminance between a foreground color (usually text) and its background. It's expressed as a ratio — 1:1 means identical colors (no contrast), while 21:1 is the maximum (black on white).
Why does it matter? Approximately 8% of men and 0.5% of women have some form of color vision deficiency (color blindness). Low contrast makes text difficult or impossible to read for these users, and also for anyone reading in bright sunlight or on a low-quality display.
WCAG Contrast Requirements
The Web Content Accessibility Guidelines (WCAG) define two success criteria for contrast:
- WCAG 2.1 AA (minimum) — The standard required by most accessibility laws (ADA in the US, EN 301 549 in the EU):
- Normal text (below 18pt): contrast ratio ≥ 4.5:1
- Large text (18pt/24px+ or 14pt/18.67px+ bold): contrast ratio ≥ 3:1
- UI components and graphical objects: contrast ratio ≥ 3:1
- WCAG 2.1 AAA (enhanced) — Stricter, recommended for critical content:
- Normal text: contrast ratio ≥ 7:1
- Large text: contrast ratio ≥ 4.5:1
How Contrast Ratio Is Calculated
The formula uses relative luminance — a measure of how bright a color appears to the human eye. RGB values are first converted to linear light (gamma-corrected) and then combined with perceptual weights:
L = 0.2126 × R + 0.7152 × G + 0.0722 × B
The contrast ratio is then: (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter luminance. The 0.05 offset accounts for ambient light reflected off a typical screen.
You don't need to calculate this by hand. Use the Contrast Checker — enter any two hex colors and it gives you the ratio and AA/AAA pass/fail instantly.
Common Contrast Failures and How to Fix Them
Gray text on white backgrounds
Light gray text (#999) on white (#fff) produces a contrast ratio of only 2.85:1 — failing AA for all text sizes. Fix: darken to #767676 (4.54:1) or stronger.
Blue links on colored backgrounds
Hyperlink blue (#0000ff) on black (#000) is 2.4:1 — a common dark mode failure. Fix: use a lighter blue (#6699ff) which hits 4.5:1 on black.
White text on light brand colors
Many brand colors (pastels, yellows, light greens) are too light to pass contrast with white text. Fix: use dark text on light brand colors, or darken the brand color variant for text use.
Placeholder text in forms
Browser default placeholder text is often #999 on white — a WCAG failure. Add custom styles: color: #6b7280 (gray-500) achieves 4.6:1 on white.
Testing Contrast in Your Design Workflow
During design (Figma / Sketch)
The Figma Accessibility plugin and the "A11y - Color Contrast Checker" plugin display contrast ratios in real time as you work. Set up your design tokens with pre-verified accessible color pairs.
During development (browser)
Chrome DevTools has a built-in contrast checker. Open DevTools → select an element → click the color swatch in the Styles panel → the contrast ratio and AA/AAA status appear directly in the color picker.
Automated testing
Tools like axe-core, Lighthouse (Accessibility audit), and WAVE can automatically detect contrast failures across your entire page. Run npx axe-cli https://yoursite.com for a quick command-line report.
Color Blindness: Beyond Contrast
Passing contrast ratios doesn't guarantee your UI works for color-blind users. The most common type — red-green color blindness (deuteranopia) — means users can't distinguish red from green at any contrast level if the only difference is hue.
Best practices:
- Never use color as the only means of conveying information. Add icons, patterns, or text labels.
- Test with a color blindness simulator (grayscale mode is a good quick test).
- Use the Color Blindness Simulator to preview how your palette looks under different vision types.
Frequently Asked Questions
Does the contrast ratio apply to decorative images?
No. WCAG contrast requirements apply to text and UI components that convey information. Pure decorative images are exempt.
Do I need AAA compliance?
AA is the legal standard in most jurisdictions. AAA is aspirational — aim for it on high-priority content like error messages and important notifications.
What about dark mode?
WCAG applies equally to dark mode. Test both color schemes — passing in light mode doesn't guarantee passing in dark mode.
Try the tools mentioned in this article
Free, browser-based, no account needed.
arrow_back Previous
Base64 Encoding Explained Simply
Next arrow_forward
10 Browser Tools That Replace Desktop Apps in 2026
Get new tool tutorials in your inbox
No spam — just new posts, occasionally.
Comments (0)
No comments yet — be the first to share your thoughts.