Part of Color & CSS

Color & DesignAccessibility

Free WCAG Color Contrast Checker

Check color contrast ratios for WCAG 2.1 AA and AAA compliance with live UI component previews, 25+ curated accessible pairs, color blindness simulations, and auto-fix suggestions.

Zero Server Upload (100% Private)100% Free & UnlimitedNo Signup Required
TA
Tanbir Ahamed
Published June 2026

Interactive Tool Workspace

Contrast Ratio
17.85:1
WCAG AA Compliant

Live UI Component Preview

Interactive Surface Preview

Accessible Digital Experience

High-contrast color pairing ensures comfortable readability for users across diverse lighting environments and visual acuity levels.

AA Normal Text (4.5:1)
AA Large Text (3.0:1)
AAA Normal Text (7.0:1)
AAA Large Text (4.5:1)

Curated Accessible Pairs (23)

How to Use

  1. 1Pick or enter Foreground (Text) and Background hex codes.
  2. 2View the live contrast ratio and instant AA/AAA pass/fail status.
  3. 3Explore 25+ curated accessible color pairs across 5 categories.
  4. 4Test real-time color blindness simulations (Protanopia, Deuteranopia, Tritanopia).
  5. 5Click suggested accessible colors to automatically fix failing contrast ratios.

Features

  • ✓Real-time WCAG 2.1 AA and AAA contrast ratio calculation
  • ✓25+ curated accessible color pairs across 5 themes (SaaS, Dark, Pastel, Alerts, AAA)
  • ✓Live interactive UI component mockup with headline, body, and CTA button
  • ✓Automatic 1-click color suggestion engine for failing pairs
  • ✓Color blindness simulation (Protanopia, Deuteranopia, Tritanopia)
  • ✓🎲 One-click Random Accessible Pair generator
  • ✓1-click color swap between foreground and background
Comprehensive Guide & Reference

The Definitive WCAG 2.1 Color Contrast Guide

Everything you need to know about AA vs. AAA compliance, luminance formulas, and inclusive design standards.

1. WCAG 2.1 Compliance Levels

  • Level AA (Minimum): Requires 4.5:1 contrast for normal body text and 3.0:1 for large text (18pt+ or 14pt bold). This is the legal accessibility requirement for most public websites.
  • Level AAA (Enhanced): Requires 7.0:1 contrast for normal text and 4.5:1 for large text. Recommended for long-form reading and mission-critical government/medical dashboards.

2. Relative Luminance Formula & Contrast Math

WCAG 2.1 calculates color contrast using linear RGB relative luminance rather than simple brightness perception. After converting each 8-bit channel (R, G, B) into sRGB space (0 to 1), values are linearized with a gamma piecewise function and combined as L = 0.2126 * R + 0.7152 * G + 0.0722 * B. Notice that green carries over 71% of perceived luminance weight, whereas blue contributes just 7.2%—explaining why pure dark blue on black often fails accessibility thresholds while muted sage green passes easily.

The final contrast ratio compares the lighter luminance (L1) against the darker luminance (L2) via (L1 + 0.05) / (L2 + 0.05), spanning from 1:1 (identical shades) up to 21:1 (pure black #000000 on pure white #FFFFFF).

3. Non-Text UI Components & Focus Indicators

Under WCAG Success Criterion 1.4.11, interactive controls—such as input borders, custom checkboxes, toggle tracks, active icons, and keyboard focus outlines—must maintain at least a 3.0:1 contrast ratio against surrounding surfaces. Placeholder text inside form inputs is also frequently flagged during accessibility audits when designers choose overly faint grays such as #9ca3af on off-white panels.

4. Color Blindness Consideration

Over 300 million people worldwide experience color vision deficiency, most commonly deuteranopia and protanopia (red-green confusion). Never rely strictly on hue differences (such as red error borders vs. green success borders) without pairing clear icons, text labels, or strong luminance separation across states.

Real example

Worked example: maximum contrast pair

Input
Text: #000000 on background: #FFFFFF
Output
→Contrast ratio: 21:1 · Passes AAA for every text size

Relative luminance is 1.0 for white and 0.0 for black, so (1.0 + 0.05) ÷ (0.0 + 0.05) = 21 — the highest ratio physically possible.

Worked example: a button color that fails body text

Input
Text: #3B82F6 on background: #FFFFFF
Output
→Contrast ratio: 3.68:1 · Fails AA for body text (needs 4.5:1) · Passes for large text (needs 3:1)

Blue-500's luminance ≈ 0.235, so 1.05 ÷ 0.285 ≈ 3.68 — fine for 18pt+ headings and UI borders, not for paragraphs.

Privacy & data handling

This tool runs entirely in your browser. What you enter is processed on your own device using JavaScript and WebAssembly — it is not uploaded to our servers, and there is no account, no signup and no per-use limit. Read our privacy policy.

Frequently Asked Questions

What is the WCAG 2.1 color contrast ratio formula?
WCAG calculates contrast using relative luminance: (L1 + 0.05) / (L2 + 0.05), where L1 is the luminance of the lighter color and L2 is the luminance of the darker color. The ratio ranges from 1:1 (no contrast) to 21:1 (maximum contrast between pure black and pure white).
What are the required contrast ratios for AA and AAA compliance?
WCAG AA requires 4.5:1 for normal body text (under 18pt / 24px) and 3:1 for large text (18pt+ or 14pt bold). WCAG AAA requires 7:1 for normal text and 4.5:1 for large text.
How does the Color Blindness Simulation work?
Our simulation applies mathematical transform matrices representing Protanopia (red-weak/blind), Deuteranopia (green-weak/blind), and Tritanopia (blue-weak/blind) so you can verify that your color pairs remain distinct for colorblind users.
Does color contrast apply to user interface components and borders?
Yes. WCAG 2.1 Success Criterion 1.4.11 (Non-text Contrast) requires a contrast ratio of at least 3:1 for graphical objects and interface components such as form field borders, toggles, icons, and focus indicators.
How is APCA different from WCAG 2 contrast calculation?
APCA (Accessible Perceptual Contrast Algorithm) is proposed for WCAG 3. It calculates contrast based on spatial frequency, font weight, polarity (dark-on-light vs light-on-dark), and perceptual lightness rather than a static mathematical ratio.
Can I swap the foreground and background colors easily?
Yes! Click the bidirectional swap arrow button between the color pickers to instantly invert the text and background selections.

Related Tools

Topical Collection

Explore all tools in Color & CSS

View collection

Related Guides