Check the contrast ratio between foreground text and background color to evaluate WCAG accessibility compliance.
The quick brown fox jumps over the lazy dog. 1234567890
| Guideline | Requirement | Status |
|---|---|---|
| WCAG AA (Normal) | 4.5:1 | Pass |
| WCAG AAA (Normal) | 7:1 | Pass |
| WCAG AA (Large) | 3:1 | Pass |
| WCAG AAA (Large) | 4.5:1 | Pass |
Why color contrast matters in web accessibility
Color contrast is the visual difference between text (or interface elements) and the background behind it. If contrast is too low, users with low vision, color-vision deficiencies, screen glare issues, or age-related vision changes may not be able to read your content comfortably. Good contrast is one of the fastest ways to improve usability for everyone.
Beyond accessibility, stronger contrast improves readability on phones outdoors, in dimly lit rooms, and on low-quality displays. It can also reduce user fatigue during long reading sessions and increase confidence when users interact with forms, buttons, and controls.
How this color contrast calculator works
This calculator uses the WCAG contrast ratio model based on relative luminance. In simple terms, each color is converted into a brightness value, then the lighter and darker colors are compared with this formula:
(L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color and L2 is the darker color.
The ratio ranges from 1:1 (same color) to 21:1 (black and white). Higher numbers mean better contrast.
WCAG thresholds to remember
- AA for normal text: 4.5:1 or higher
- AAA for normal text: 7:1 or higher
- AA for large text: 3:1 or higher
- AAA for large text: 4.5:1 or higher
“Large text” means at least 24px regular weight, or around 19px bold. For most body text, target the normal text thresholds.
How to use the calculator effectively
1) Enter or pick your colors
Use hex values like #1a1a1a and #ffffff. You can type directly or use the color pickers.
2) Review ratio and compliance
After calculating, check both the numeric contrast ratio and the pass/fail statuses for AA and AAA. If your primary body text fails AA, update your palette before moving forward.
3) Check realistic examples
Update the sample text to mimic your actual UI copy (headings, links, button labels, helper text). Contrast that passes in theory but feels harsh or unclear in your real UI may still need refinement.
Practical tips for better contrast design
- Prefer near-black text over pure gray for body copy on light backgrounds.
- Avoid placing text over photos unless you add an overlay.
- Test hover, focus, disabled, and visited states—not just default states.
- Ensure form placeholders and validation messages are readable.
- Use more than color alone to communicate status (add icons or text labels).
Common mistakes teams make
Relying on brand colors only
Brand palettes often look great in print but fail digital accessibility standards. Build an accessible “UI palette layer” mapped to your brand, rather than using raw brand values everywhere.
Ignoring component states
Many interfaces pass contrast in default state but fail on hover or disabled states. Audit complete interaction states for links, buttons, tabs, and inputs.
Forgetting non-text contrast
WCAG also expects sufficient contrast for important UI boundaries and icons. Thin borders, toggles, and chart labels are common failure points.
Quick accessibility checklist for contrast
- Body text meets at least 4.5:1 against its background.
- Large headings meet at least 3:1 (prefer 4.5:1 where possible).
- Buttons and links remain readable in all states.
- Error and success messages are readable and not color-only.
- Design tokens include contrast-safe combinations.
Use this calculator early in design, not just during QA. Accessibility is easiest when it is built into your color system from the start.