Color Contrast Checker
Verify WCAG 2.1 AA and AAA color contrast ratios with accessible color suggestions.
Color Tokens (HEX)
Large Heading Text (18pt / 24px+)
Normal body text (16px regular). Good contrast ensures software interfaces remain legible across outdoor glare, low-brightness displays, and visual impairments.
What Does the Color Contrast Checker Do?
The Color Contrast Checker computes the relative luminance of two sRGB HEX colors and calculates their exact contrast ratio (from 1:1 to 21:1) using the official W3C WCAG 2.1 formula.
It evaluates the pair against four core thresholds: WCAG AA Normal Text (4.5:1), WCAG AA Large Text & UI Components (3.0:1), WCAG AAA Normal Text (7.0:1), and WCAG AAA Large Text (4.5:1).
When a color combination fails AA or AAA targets, the tool automatically calculates the nearest lighter or darker foreground and background shades that satisfy the required contrast threshold.
How to Use This Tool
- Pick or enter a 3-digit or 6-digit HEX code for both Foreground (Text) and Background colors.
- Review the calculated contrast ratio (e.g., 8.59:1) and the Pass/Fail badges for Normal Text and Large Text.
- If a level fails, click any recommended accessible color swatch to apply it immediately.
Common Engineering Use Cases
- Auditing design system tokens, button labels, muted secondary text, and badge colors for WCAG 2.1 compliance.
- Testing dark mode and light mode theme palettes before shipping frontend stylesheets.
- Finding the minimal lightness adjustment needed to bring a brand color into AA (4.5:1) or AAA (7.0:1) compliance.
Practical Developer Examples
High-Contrast Dark Theme Text
Slate-50 (#F8FAFC) text on a Slate-900 (#0F172A) background achieves 17.45:1, passing all AA and AAA criteria.
Foreground: #F8FAFC, Background: #0F172A
Contrast Ratio: 17.45:1 — Passes AA Normal, AA Large, AAA Normal, AAA Large
Common Mistakes & Pitfalls to Avoid
- Using low-contrast gray placeholder text (e.g., #94A3B8 on #FFFFFF, which is only 2.56:1) for essential form labels or instructions.
- Forgetting that WCAG Large Text requires at least 18pt (24px) regular weight or 14pt (18.66px) bold weight.
Frequently Asked Questions
How is WCAG contrast ratio calculated?
First, each sRGB channel (R, G, B) is linearized and weighted (0.2126 R + 0.7152 G + 0.0722 B) to compute relative luminance L between 0 and 1. The contrast ratio is (L_lighter + 0.05) / (L_darker + 0.05).