Free Color Contrast Checker Online
WCAG accessibility compliance validator. Runs entirely in your browser — no signup, no uploads, private by default.
Color Contrast Checker
WCAG accessibility compliance validator
WCAG 2.1 Compliance
Live Preview
What is Color Contrast and Why Does It Matter?
Color contrast refers to the difference in luminance between foreground content (usually text) and background colors. Sufficient contrast ensures that text and UI elements are readable for everyone, including people with visual impairments, color blindness, or age-related vision changes. The Web Content Accessibility Guidelines (WCAG) establish minimum contrast ratios to ensure digital content is accessible to the widest possible audience.
Poor color contrast creates barriers for millions of users. Text with insufficient contrast against its background becomes difficult or impossible to read, especially in bright sunlight, on low-quality displays, or for users with low vision. Meeting WCAG contrast requirements isn't just good practice—it's often legally required under accessibility laws like the Americans with Disabilities Act (ADA), Section 508, and the European Accessibility Act.
Beyond legal compliance, good contrast improves usability for everyone. High-contrast text is easier to read, reduces eye strain, and improves comprehension. Users can consume content faster and with less effort when contrast is optimized. This translates directly to better user engagement, longer session times, and higher conversion rates for websites and applications.
Understanding WCAG Contrast Requirements
The Web Content Accessibility Guidelines define specific contrast ratio requirements across different conformance levels:
WCAG Level AA (Minimum Compliance): The baseline standard that most organizations target. Level AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold). This level is referenced in most accessibility laws and is considered the minimum for legal compliance.
WCAG Level AAA (Enhanced): More stringent requirements for situations demanding maximum accessibility. Level AAA requires 7:1 contrast for normal text and 4.5:1 for large text. While not legally required in most cases, AAA compliance benefits users with more severe visual impairments and represents best-practice accessibility.
Large Text Definition: WCAG defines large text as 18 point (24px) or larger for regular weight, or 14 point (18.5px) or larger for bold text. Large text has lower contrast requirements because size itself improves readability.
UI Components and Graphics (WCAG 2.1): Non-text elements like icons, form borders, and interactive components must maintain 3:1 contrast against adjacent colors. This ensures UI elements are perceivable and usable.
Incidental Content Exceptions: Inactive/disabled controls, decorative elements, and text within logos are exempt from contrast requirements. However, overusing these exceptions can create accessibility problems.
How to Use the Color Contrast Checker
Our tool makes WCAG compliance testing fast and intuitive:
- Select Foreground Color: Click the color picker or enter a hex code for your text or UI element color. The foreground is what users will read or interact with.
- Select Background Color: Choose the background color that appears behind your foreground element. For gradient or image backgrounds, test against the lightest and darkest areas.
- Review Contrast Ratio: The tool instantly calculates and displays the contrast ratio between your selected colors. Ratios range from 1:1 (no contrast) to 21:1 (maximum contrast).
- Check WCAG Compliance: Green checkmarks indicate passing grades; red X marks show failures. See instantly whether your combination meets AA or AAA requirements for different text sizes.
- Preview Real Examples: View live previews showing how your color combination looks in actual use cases: normal text, large headings, buttons, and links.
- Get Suggestions: If your colors fail compliance, click "Suggest Accessible Colors" to see alternative colors that pass WCAG requirements while staying close to your original choices.
- Swap Colors: Use the swap button to reverse foreground and background colors, useful when testing light-on-dark versus dark-on-light themes.
How Contrast Ratios Are Calculated
Contrast ratios are calculated using relative luminance values defined in the WCAG specification. Understanding this calculation helps you make better color choices:
Relative Luminance: First, the tool converts RGB color values into relative luminance—a measurement of how bright a color appears to the human eye. Luminance accounts for the fact that human eyes are more sensitive to green light than red or blue.
Contrast Formula: The contrast ratio is calculated as (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 0.05 offset prevents division by zero for pure black.
Ratio Interpretation: The resulting ratio ranges from 1:1 (same color) to 21:1 (black on white or white on black). Higher ratios indicate greater contrast. A 4.5:1 ratio means the lighter color is 4.5 times brighter than the darker color.
Perceptual, Not Mathematical: The calculation is based on human perception, not mathematical color distance. Two colors that seem very different mathematically might have poor contrast if they have similar luminance.
Color Blindness Considerations: Luminance-based contrast works for most forms of color blindness because it doesn't rely on hue differentiation. However, you should still avoid using color alone to convey information.
Common Contrast Mistakes to Avoid
Even experienced designers make these frequent contrast errors:
- Gray Text on White Backgrounds: The most common violation. Light gray (#999999, #AAAAAA) on white fails AA contrast. Use #767676 or darker for normal text, or #595959 for AAA compliance.
- Brand Colors Without Testing: Corporate brand colors often fail contrast requirements. Always test and be prepared to use darker or lighter variants for accessibility.
- Colored Text on Colored Backgrounds: Blue text on green backgrounds, purple on red, or other color combinations often fail despite looking distinct. Test every combination.
- Assuming Visual Difference Equals Contrast: Two colors can look very different but have similar luminance, resulting in poor contrast. Orange and green can look distinct but measure poorly.
- Overlay Text on Images: Text overlaid on photos or gradients often fails contrast in some areas. Use semi-transparent overlays behind text or test against the most problematic background areas.
- Link Color Without Underlines: If links are only distinguished by color, the color must have 3:1 contrast with surrounding text AND meet 4.5:1 against the background. Always underline links to avoid this requirement.
- Placeholder Text: Input placeholder text often uses light gray that fails contrast requirements. Placeholders must meet the same 4.5:1 ratio as regular text.
- Disabled Controls: While exempt from requirements, completely invisible disabled states create poor UX. Aim for at least 3:1 contrast even for disabled elements.
Designing Accessible Color Palettes
Creating accessible color systems from the start saves time and ensures compliance:
Start with Extremes: Begin with pure black (#000000) and pure white (#FFFFFF), which provide 21:1 contrast. Then create intermediate shades that meet specific contrast requirements.
Generate Systematic Scales: Create color scales with defined contrast ratios at each step. For example, generate grays ranging from 21:1 to 3:1 against white, ensuring you have compliant options for every use case.
Test Primary Colors Early: Test your brand colors against your primary backgrounds immediately. Identify which colors need darker or lighter variants for accessibility.
Create Accessible Pairs: For each brand color, create a documented accessible pairing with backgrounds it works on. "Blue-600 on white" and "Blue-200 on Blue-900" as proven combinations.
Account for Dark Mode: Test your entire palette in both light and dark themes. Colors that work on white backgrounds may fail on dark backgrounds, requiring separate dark-mode variants.
Semantic Color Naming: Name colors by their contrast level rather than appearance. "text-primary" (7:1 AAA), "text-secondary" (4.5:1 AA), "text-disabled" (3:1 UI) helps developers choose correctly.
Documentation: Document which color combinations pass which WCAG levels. This prevents future designers from unknowingly creating inaccessible combinations.
Testing Contrast in Context
Automated tools catch many issues, but context matters for complete accessibility:
Test on Actual Devices: Colors appear differently on various displays. Test on multiple monitors, phones, and tablets. OLED screens, cheap LCDs, and premium displays all render contrast differently.
Ambient Lighting Conditions: Test in bright sunlight, dim rooms, and normal office lighting. Contrast that works indoors may fail outdoors. Mobile apps especially need higher contrast for outdoor use.
Screen Reader Compatibility: While contrast doesn't affect screen readers directly, good visual contrast often correlates with proper semantic HTML that screen readers rely on.
Zoom and Magnification: Test at 200% zoom. Poor contrast becomes more problematic when magnified. UI elements should remain clear and borders visible at high zoom levels.
Motion and Animation: Moving text or content needs higher contrast than static content because motion makes text harder to read. Consider exceeding minimum ratios for animated elements.
Small Text and Icons: Text smaller than 16px or intricate icons may need higher contrast than WCAG minimums to remain legible. The WCAG minimums assume reasonably sized text.
User Testing: Include users with visual impairments in testing. Automated tools check ratios but can't assess real-world usability for people who actually need high contrast.
Contrast for Different Visual Impairments
Different vision conditions create different contrast needs:
Low Vision: Users with reduced visual acuity need high contrast to distinguish text from backgrounds. AAA compliance (7:1) significantly helps low vision users, especially for extended reading.
Color Blindness: Luminance-based contrast works regardless of color perception. However, never rely on color alone—use text labels, icons, and patterns in addition to color coding.
Cataracts: Clouded lenses scatter light, reducing perceived contrast. Users with cataracts benefit from maximum contrast and may see halos around light text on dark backgrounds.
Glaucoma: Peripheral vision loss makes it crucial that focus areas have excellent contrast. Central content contrast is especially important for glaucoma patients.
Age-Related Vision Changes: Aging reduces contrast sensitivity even without specific diagnoses. Designing for older adults means exceeding WCAG minimums whenever possible.
Photophobia: Light sensitivity makes bright white backgrounds painful. Offer dark mode options with appropriate contrast maintained in the darker theme.
Dark Mode and Contrast Considerations
Dark themes present unique contrast challenges:
Not Just Inverted Colors: Simply inverting light theme colors rarely works. Dark themes need carefully selected colors that maintain proper contrast without being harsh.
Avoid Pure White on Pure Black: While 21:1 contrast might seem ideal, pure white on pure black can cause eye strain and halation effects. Use slightly off-white (#F8F8F8) on dark gray (#121212) instead.
Saturation Adjustments: Highly saturated colors appear to vibrate on dark backgrounds. Reduce saturation in dark mode while maintaining sufficient contrast.
Elevation and Layering: Dark themes often use lighter grays to indicate elevated surfaces. Ensure sufficient contrast between layers and between text and each layer.
Test in Low Light: Dark mode is often used in dim environments. Test your dark theme in actual low-light conditions to ensure it's comfortable and readable.
User Preference: Respect system preferences for light/dark mode. Some users need dark mode for comfort; others find it harder to read. Always offer both.
Legal Requirements and Compliance
Accessibility isn't optional—it's legally required in many contexts:
ADA (Americans with Disabilities Act): U.S. courts increasingly rule that websites must be accessible. While the ADA doesn't explicitly mention WCAG, courts reference WCAG 2.1 AA as the de facto standard.
Section 508: U.S. federal agencies and contractors must meet Section 508 requirements, which incorporate WCAG 2.0 Level AA. This affects any organization doing government work.
European Accessibility Act: EU member states must ensure public sector websites meet WCAG 2.1 Level AA. Private sector organizations face increasing pressure for compliance.
Industry-Specific Requirements: Education (IDEA), healthcare (meaningful use), and financial services have specific accessibility mandates that include contrast requirements.
Litigation Risk: Accessibility lawsuits have increased dramatically. Poor contrast is easily documented and commonly cited in legal complaints. Prevention is far cheaper than remediation.
Certification and Audits: Many organizations require accessibility certification. WCAG compliance, including contrast, is fundamental to passing VPAT (Voluntary Product Accessibility Template) audits.
Tools and Workflows for Maintaining Contrast
Integrate contrast checking into your design and development workflow:
Design Tool Plugins: Install contrast checker plugins for Figma, Sketch, or Adobe XD. Check contrast during design, not after development. Popular plugins include Stark, Contrast, and A11y.
Browser DevTools: Chrome and Firefox include built-in contrast checkers in their inspect element tools. Hover over elements to see instant contrast ratio calculations.
Automated Testing: Integrate accessibility testing into CI/CD pipelines. Tools like axe, Pa11y, and Lighthouse check contrast automatically on every commit.
Component Libraries: Build accessible components with tested color combinations. Document which variants meet which WCAG levels to prevent future violations.
Style Linting: Use stylelint plugins that enforce minimum contrast ratios in CSS. Fail builds that introduce accessibility violations.
Design Systems: Create design tokens with proven accessible combinations. Make it easier to do the right thing than to create inaccessible designs.
Regular Audits: Conduct quarterly accessibility audits including contrast checks. Catch regressions early before they become systemic problems.
Beyond Contrast: Complete Visual Accessibility
Contrast is crucial but not the only visual accessibility consideration:
Don't Rely on Color Alone: Use multiple visual indicators—color plus icons, patterns, or text labels. Never communicate information through color exclusively.
Text Size and Weight: Sufficient text size (16px minimum) and appropriate font weights improve readability beyond what contrast alone provides.
Focus Indicators: Keyboard focus indicators need 3:1 contrast against backgrounds. Make focus states obvious for keyboard navigation users.
Spacing and Layout: Adequate whitespace, line height (1.5 minimum), and paragraph spacing improve readability alongside good contrast.
Font Selection: Choose clear, legible fonts. Decorative or script fonts need higher contrast to compensate for complex letterforms.
Responsive Contrast: Maintain proper contrast across all viewport sizes. Mobile designs often need adjustments to preserve contrast on smaller screens.
Frequently Asked Questions
What contrast ratio should I aim for?
Minimum WCAG AA compliance requires 4.5:1 for normal text and 3:1 for large text. For better accessibility, target AAA levels (7:1 for normal text) whenever possible, especially for body copy and important content.
Do logos and decorative elements need to meet contrast requirements?
No, logos and purely decorative elements are exempt from WCAG contrast requirements. However, any functional elements (clickable logos, navigation items) must meet contrast standards.
How do I handle text over images?
Add a semi-transparent overlay between the image and text, use text shadows for increased contrast, or blur the background image. Test contrast against both the lightest and darkest parts of the image.
Can I use my brand colors if they fail contrast tests?
Yes, but create darker or lighter variants for text and functional elements. Reserve the exact brand color for large elements, backgrounds, or non-text accents where contrast requirements are more flexible.
Do gradient backgrounds affect contrast testing?
Yes, test text contrast against the most problematic part of the gradient. If any part of the gradient fails contrast, the entire combination fails. Consider solid overlays behind text on gradients.
Is there a difference between contrast for light and dark mode?
The same contrast ratios apply to both themes, but color selection differs. Dark themes often need desaturated colors and slightly reduced contrast to avoid eye strain while still meeting WCAG requirements.