How to Check Color Contrast for Accessibility

Summary: Accessible color contrast isn't a nice-to-have โ€” it's a legal and ethical requirement. This guide explains WCAG contrast ratios in plain language, walks you through AA and AAA compliance levels, covers color blindness considerations, and gives you practical techniques to fix low-contrast issues. Over 1 billion people benefit from accessible design. Here's how to get it right.

๐Ÿ“– 24 min readยทUpdated March 2026

1. What Is WCAG?

WCAG (Web Content Accessibility Guidelines) is the international standard for web accessibility, maintained by the W3C (World Wide Web Consortium). It provides a set of success criteria organized around four principles: Perceivable, Operable, Understandable, and Robust (POUR).

WCAG 2.2, released in October 2023, is the current version. It builds on WCAG 2.1 with additional criteria focused on mobile accessibility, cognitive disabilities, and user input. Color contrast falls under the "Perceivable" principle โ€” specifically Success Criterion 1.4.3 (Contrast Minimum) and 1.4.6 (Contrast Enhanced).

The guidelines define three conformance levels: A (minimum), AA (standard), and AAA (enhanced). Most legal requirements and organizational policies target Level AA compliance. Level AAA is aspirational โ€” meeting it for all content is often impractical, but striving for it wherever possible benefits all users.

2. Contrast Ratio Explained

A contrast ratio is a number that describes the relative luminance difference between two colors. It ranges from 1:1 (no contrast โ€” identical colors) to 21:1 (maximum contrast โ€” pure black on pure white). The formula uses the relative luminance of each color, which accounts for how the human eye perceives brightness differently across the color spectrum.

The calculation works like this: take the lighter color's relative luminance, add 0.05, and divide by the darker color's relative luminance plus 0.05. Relative luminance itself is calculated by converting sRGB values through a gamma correction formula that weights green most heavily (our eyes are most sensitive to green light), followed by red, then blue.

Contrast ratio = (L1 + 0.05) / (L2 + 0.05)

Where L1 is the relative luminance of the lighter color and L2 is the darker.

You don't need to do this math yourself โ€” tools handle it automatically. What matters is understanding that the resulting ratio tells you how readable text will be against a given background. Use Hue's contrast checker to test any combination instantly.

21:1Black on white. Maximum contrast. Always passes.
7:1+Excellent. Passes AAA for all text sizes.
4.5:1Good. Passes AA for normal text, AAA for large text.
3:1Minimum. Only passes AA for large text (18pt+) and UI components.
<3:1Fails all WCAG criteria. Do not use for meaningful text.

3. AA vs AAA Compliance

The two contrast levels you'll encounter most often are AA and AAA. Understanding the difference is crucial for setting the right targets for your project.

Level AA (Standard)

  • โ€ข Normal text: 4.5:1 minimum
  • โ€ข Large text (โ‰ฅ18pt or โ‰ฅ14pt bold): 3:1 minimum
  • โ€ข UI components & graphics: 3:1 minimum
  • โ€ข Required by most legal frameworks
  • โ€ข Achievable for most designs

Level AAA (Enhanced)

  • โ€ข Normal text: 7:1 minimum
  • โ€ข Large text (โ‰ฅ18pt or โ‰ฅ14pt bold): 4.5:1 minimum
  • โ€ข Best possible readability
  • โ€ข Aspirational for full compliance
  • โ€ข Achievable for body text & key content

For most projects, target AA across the board and AAA where feasible (especially for body text, which users spend the most time reading). Large headings have more relaxed requirements because their size already aids readability.

WCAG defines "large text" as at least 18 point (24px) regular weight or 14 point (approximately 18.66px) bold. Anything below those thresholds is considered normal text and needs the higher contrast ratio.

4. Why Accessibility Matters

Web accessibility isn't just good practice โ€” it's increasingly a legal requirement with direct business consequences.

The Numbers

The World Health Organization estimates that 1.3 billion people โ€” roughly 16% of the global population โ€” experience significant disability. Of these, approximately 2.2 billion have near or distance vision impairment, and 300 million are color blind. These aren't edge cases. They represent a massive portion of your potential audience who will struggle or leave if your colors don't have adequate contrast.

Legal Compliance

In the United States, web accessibility lawsuits under the ADA have surged. Over 4,600 digital accessibility lawsuits were filed in 2023 alone. The European Accessibility Act (EAA), effective June 2025, requires digital products and services to meet accessibility standards across the EU. Australia's Disability Discrimination Act, Canada's Accessible Canada Act, and the UK's Equality Act all include provisions that apply to websites.

Business Impact

Beyond legal risk, accessibility is good business. Accessible sites tend to have better SEO (search engines value semantic HTML and good structure), lower bounce rates (readable text keeps people engaged), and wider market reach. The disposable income of disabled people globally is estimated at over $8 trillion. Excluding them from your product isn't just wrong โ€” it's expensive.

5. How to Test Contrast

Testing contrast should be a regular part of your design and development workflow โ€” not a final audit step. Here's how to integrate it at every stage.

During Design

Use Hue's contrast checker while selecting colors. Enter your foreground and background hex values and instantly see the contrast ratio with AA and AAA pass/fail indicators for both normal and large text. This catches issues before they reach code.

During Development

Browser DevTools have built-in contrast checking. In Chrome, inspect any text element, click the color swatch in the Styles panel, and the color picker shows the contrast ratio against its background with WCAG pass/fail indicators. Firefox and Safari have similar features.

Automated Testing

Integrate accessibility linting into your CI/CD pipeline. Tools like axe-core, Lighthouse, and pa11y can automatically flag contrast violations on every deploy. These catch regressions when new features inadvertently introduce low-contrast text.

Manual Auditing

Automated tools catch about 30-40% of accessibility issues. Manual testing remains essential. Tab through your site to check focus indicators. Use browser zoom (200%) to verify readability. Test with screen readers. And simply squint โ€” if you can't read text while squinting, your contrast needs work.

6. Fixing Low Contrast Issues

Found contrast failures? Here are practical techniques to fix them without redesigning your entire palette.

Darken or Lighten

The simplest fix: adjust the lightness of your text or background until the ratio meets the threshold. Often, darkening text by just 10-15% in HSL lightness is enough to cross 4.5:1. This preserves your brand color's hue and saturation while improving readability.

Increase Font Size or Weight

Remember: large text (โ‰ฅ18pt regular or โ‰ฅ14pt bold) only needs 3:1. If your text is close to passing at 4.5:1, making it larger or bolder might bring it into compliance without changing colors at all. This is especially useful for headings and UI labels.

Add a Background

For text on variable backgrounds (like photos), add a semi-transparent overlay or solid background behind the text. A dark overlay of rgba(0, 0, 0, 0.6) behind white text creates reliable contrast regardless of the image beneath.

Use Your Palette Generator

Tools like Hue's palette generator create colors that already have good tonal range. Starting with a well-structured palette prevents most contrast issues before they start.

7. Text on Images

Placing text directly over images is one of the most common contrast failures on the web. Images have variable brightness โ€” a color that's readable over the dark part of a photo may vanish over a bright area.

Overlay Techniques

/* Dark overlay for white text */
.hero-image {
  position: relative;
}
.hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.7)
  );
}

/* Frosted glass effect */
.text-overlay {
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
}

A gradient overlay that's darker at the bottom (where text usually sits) preserves the image's visual impact while ensuring readability. The frosted glass technique works well for floating text boxes โ€” it adapts to any underlying image brightness while maintaining contrast. For more on gradient techniques, see our guide on how to create CSS gradients.

Text Shadow

Adding a subtle text shadow can improve readability without overlays: text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8). However, WCAG doesn't count text shadows in contrast calculations. Treat them as an enhancement, not a solution.

8. Color Blindness Considerations

Color vision deficiency (CVD), commonly called color blindness, affects how people perceive color differences. Designing for CVD isn't about removing color โ€” it's about ensuring information is never conveyed by color alone.

Deuteranopia (Green-Weak) โ€” ~5% of males

The most common type. Difficulty distinguishing red from green. Red and green appear similar (brownish/yellowish). Traffic lights are distinguished by position, not color.

Protanopia (Red-Weak) โ€” ~2.5% of males

Similar to deuteranopia but with reduced sensitivity to red. Red appears darker and can be confused with dark brown or black. Red warning indicators may be invisible.

Tritanopia (Blue-Weak) โ€” ~0.01% of population

Rare. Difficulty distinguishing blue from yellow and blue from green. Affects both sexes equally (it's not X-linked like red-green CVD).

Achromatopsia (Total Color Blindness) โ€” ~0.003%

Extremely rare. Complete inability to perceive color โ€” everything appears in shades of gray. These users rely entirely on luminance contrast.

Design Strategies for Color Blindness

  • Use icons alongside color: Don't just make errors red โ€” add an error icon (โœ—) and error text
  • Add patterns or textures: In charts and graphs, use distinct patterns (stripes, dots) in addition to colors
  • Avoid red/green only combinations: Use red/blue or orange/blue for contrasting states
  • Test with simulation tools: Chrome DevTools > Rendering > Emulate vision deficiencies
  • Ensure sufficient luminance contrast: If two colors look different in grayscale, they'll work for color-blind users

9. CSS Techniques for Better Contrast

Modern CSS provides several techniques to ensure and maintain good contrast across your designs.

Focus Indicators

/* High-contrast focus ring */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Remove default, add custom */
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-bg),
              0 0 0 5px var(--color-accent);
}

Respecting User Preferences

/* Increase contrast when user prefers it */
@media (prefers-contrast: more) {
  :root {
    --color-text: #000000;
    --color-bg: #ffffff;
    --color-border: #000000;
  }
}

/* Reduce motion AND increase contrast */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  .custom-button {
    border: 2px solid ButtonText;
  }
}

The prefers-contrast media query, now supported in all major browsers, lets you provide enhanced contrast versions of your design for users who've configured their OS to request it. Combined with CSS custom properties, you can swap to a high-contrast palette with just a few lines of CSS. See MDN's accessibility documentation for full details.

10. Tools and Browser Extensions

The right tools make accessibility testing fast and routine rather than a chore.

Hue Contrast Checker

Our built-in WCAG 2.1 contrast tester with live preview, AA/AAA ratings for normal and large text, and color swap. Try it free โ†’

WebAIM Contrast Checker

The classic web-based tool from the WebAIM organization. Simple, reliable, and widely referenced. webaim.org

axe DevTools Extension

Browser extension from Deque Systems that scans pages for accessibility issues, including contrast failures. Available for Chrome, Firefox, and Edge.

Chrome DevTools

Built-in contrast checking in the Elements panel color picker, plus vision deficiency emulation in the Rendering tab. No extension needed.

The A11Y Project

Community-driven resource with checklists, guides, and tool recommendations for web accessibility. a11yproject.com

Frequently Asked Questions

What contrast ratio should I aim for?

Target 4.5:1 minimum for all normal text (WCAG AA). Aim for 7:1 where feasible, especially for body text. Large text (โ‰ฅ18pt) can use 3:1 minimum. When in doubt, go higher โ€” there's no such thing as too much readability.

Do contrast requirements apply to decorative text?

WCAG exempts "incidental" text โ€” text in inactive UI components, purely decorative text, and text that's not visible to anyone. However, if text conveys information, it needs adequate contrast regardless of how decorative it appears.

Is dark mode more accessible than light mode?

Neither mode is inherently more accessible. What matters is contrast ratios. Some users with photophobia or light sensitivity prefer dark mode, while users with certain types of astigmatism find light mode easier to read. The most accessible approach is supporting both with adequate contrast in each.

Can I get sued for poor color contrast?

Yes. Web accessibility lawsuits are increasing worldwide. In the US, ADA-related digital accessibility lawsuits exceed 4,000 per year. The EU's European Accessibility Act requires compliance from June 2025. Even without lawsuits, many government and enterprise contracts require WCAG AA compliance.

How do I check contrast on gradients?

Test the worst-case scenario โ€” the point where your gradient color has the least contrast with the text. For a gradient from dark blue to light blue with white text, test the light blue end. If the lightest point passes, the whole gradient passes. Use Hue's gradient generator to preview gradient backgrounds.

Do color contrast rules apply to icons and UI components?

Yes. WCAG 2.1 Success Criterion 1.4.11 requires non-text elements (icons, borders, form fields, focus indicators) to have a minimum 3:1 contrast ratio against adjacent colors. This is a common oversight โ€” check your icon colors, not just your text.

12. WCAG 2.2 vs WCAG 3.0 APCA

The current WCAG 2.2 contrast algorithm has served the web well, but it has known limitations. The upcoming WCAG 3.0 specification introduces a fundamentally different approach to measuring contrast called APCA (Accessible Perceptual Contrast Algorithm), developed by Andrew Somers. Understanding the differences now will prepare you for the transition ahead.

How WCAG 2.x Contrast Works

The current WCAG 2.2 method calculates a simple luminance ratio between foreground and background colors. It treats all colors the same regardless of whether the text is light-on-dark or dark-on-light, and it doesn't account for font size or weight beyond the basic "large text" threshold. This leads to situations where the math says a combination passes but human eyes disagree โ€” particularly with dark-on-dark or light-on-light pairings where the ratio is technically adequate but readability is poor.

What APCA Changes

APCA is a perceptually modeled algorithm that accounts for how human vision actually works. It considers polarity (light text on dark backgrounds is perceived differently from dark text on light backgrounds), spatial frequency (font size and weight affect perceived contrast), and the non-linear way our eyes adapt to different luminance levels. Instead of a single ratio, APCA produces a Lightness Contrast (Lc) value that ranges from 0 to approximately 108.

WCAG 2.x Approach

Simple luminance ratio (e.g., 4.5:1). Same threshold regardless of text direction, font size, or weight beyond large/normal distinction. Known to over-restrict some safe combinations and under-restrict some problematic ones.

APCA Approach

Perceptual lightness contrast (Lc value). Font-size and weight-dependent thresholds. Accounts for polarity (light-on-dark vs dark-on-light). More nuanced and accurate for real-world readability. Try the APCA contrast calculator to compare.

For example, APCA recognizes that 14px bold text needs a higher Lc value than 24px bold text to be equally readable โ€” something the current WCAG model handles only with its rough large/normal split. APCA also correctly identifies that white text on a medium-blue background is more readable than black text on the same background at the same mathematical contrast ratio, because human perception of lightness contrast is asymmetric.

Should You Switch Now?

WCAG 3.0 is still in draft status and won't replace WCAG 2.2 as the legal standard anytime soon. For compliance purposes, continue targeting WCAG 2.2 AA ratios. However, using APCA as an additional check during design โ€” especially for edge cases where the WCAG 2.x ratio seems wrong โ€” gives you a more accurate picture of real-world readability. Many designers already use both tools in parallel.

13. Color Contrast for Different UI Elements

Not all UI elements are created equal when it comes to contrast requirements. WCAG defines different rules for different element types, and understanding these nuances prevents both false passes and unnecessary design restrictions.

Buttons and Interactive Controls

Buttons need to meet contrast requirements in two ways: the button text must contrast with the button background (4.5:1 for normal text), and the button itself must be visually identifiable against the page background. WCAG 2.1 SC 1.4.11 (Non-text Contrast) requires a minimum 3:1 contrast ratio for the button's boundary or fill against its surroundings. This means a light gray button on a white background may fail even if the button text is black.

Links Within Text

Links embedded in body text face a unique challenge: they need to be distinguishable from surrounding text and contrast with the background. If your links are styled only with color (no underline), WCAG requires a 3:1 contrast ratio between the link color and the surrounding text color, plus 4.5:1 against the background. The simplest solution? Always underline links in body text โ€” it removes the color-only dependency entirely.

Icons and Graphics

Icons that convey information (not purely decorative) need 3:1 contrast against their background per SC 1.4.11. This includes status icons, navigation icons, social media icons, and chart elements. Decorative icons that duplicate adjacent text (like a search icon next to the word "Search") are exempt, but err on the side of meeting contrast anyway โ€” users scan visually, and clear icons improve usability for everyone.

Placeholder Text

This is one of the most commonly failed contrast checks on the web. Placeholder text in form fields is often styled in light gray (#999 or similar) that fails the 4.5:1 requirement. The argument that "it's just a hint" doesn't hold โ€” if users are expected to read it, it needs adequate contrast. Better yet, use visible labels above inputs rather than relying on placeholder text for critical information.

Disabled States

WCAG 2.2 explicitly exempts "inactive user interface components" from contrast requirements. This means disabled buttons, grayed-out options, and inactive form fields don't need to meet 4.5:1 or 3:1 ratios. However, disabled states should still be perceptible โ€” users need to understand the element exists but isn't currently interactive. A contrast ratio of roughly 2:1 to 3:1 typically communicates "disabled" without being invisible.

Focus Indicators

WCAG 2.2 introduced SC 2.4.13 (Focus Appearance), requiring focus indicators to have a minimum area and contrast. The focus indicator must have at least a 3:1 contrast ratio against the unfocused state and against adjacent colors. Browser default focus rings usually satisfy this, but custom focus styles (which many designs implement) need careful testing. Use Hue's contrast checker to verify your focus ring color against both the element and page backgrounds.

14. Color Blindness Simulation

Testing your designs with color blindness simulators is one of the most impactful accessibility practices you can adopt. Simulation tools transform your screen to show approximately what users with different types of color vision deficiency (CVD) see, revealing problems that pure contrast ratios can miss.

Types of Color Vision Deficiency

There are three main categories of color blindness, each affecting different cone cells in the retina:

Protanopia & Protanomaly (Red-Deficient)

Affects ~2.5% of males. The red cones are absent (protanopia) or shifted (protanomaly). Red appears dark, almost black. Red-orange warning colors may be invisible. Red/green, red/brown, and pink/gray distinctions are lost. Critical for error states โ€” a red error message may not register at all.

Deuteranopia & Deuteranomaly (Green-Deficient)

The most common form, affecting ~5% of males. Green cones are absent or shifted. Similar confusion patterns to protanopia (red/green confusion) but red doesn't appear as dark. Green success indicators and red error indicators look nearly identical. This is why success/error states should always include icons and text.

Tritanopia & Tritanomaly (Blue-Deficient)

Rare (~0.01% of population), affects both sexes equally. Blue appears greenish, yellow appears pinkish. Blue/yellow and blue/green distinctions are lost. Less commonly tested for, but still important โ€” especially for data visualizations that use blue-yellow color scales.

Simulation Tools

Chrome DevTools has built-in vision deficiency emulation. Open DevTools โ†’ press Ctrl+Shift+P โ†’ type "Rendering" โ†’ scroll to "Emulate vision deficiencies" and select from protanopia, deuteranopia, tritanopia, achromatopsia, or blurred vision. This is the fastest way to test because you can see your live site through each filter without any installation.

Sim Daltonism (macOS/iOS) is a dedicated color blindness simulator that floats a filter window over your entire screen. Drag it over any application โ€” Figma, your browser, Sketch โ€” and see through different CVD types in real time. It's particularly useful during design work because you can keep it open alongside your design tool.

Stark is a premium accessibility plugin for Figma, Sketch, and Adobe XD that includes contrast checking, color blindness simulation, and focus order visualization all in one tool. If accessibility is a regular part of your workflow (it should be), Stark pays for itself in time saved.

Firefox Accessibility Inspector also includes a simulation panel. Right-click โ†’ Inspect โ†’ Accessibility tab โ†’ "Simulate" dropdown. Firefox's accessibility tools are underrated and worth exploring if you develop cross-browser.

What to Look For

  • Status indicators: Can you still distinguish success (green) from error (red) in protanopia/deuteranopia mode?
  • Charts and graphs: Are all data series distinguishable through each CVD type?
  • Navigation: Can you identify the active/selected state without relying on color alone?
  • Form validation: Are error fields identifiable without red color โ€” through icons, borders, text?
  • Links: Are links still distinguishable from body text through each simulation?

15. Contrast in Dark Mode

Dark mode introduces unique contrast challenges that light mode designers don't face. The same accent color that passes WCAG AA on a white background may fail on a dark gray one โ€” and the perceptual rules change when the majority of the viewport is dark rather than light.

Avoid Pure Black Backgrounds

Pure black (#000000) with pure white (#FFFFFF) text creates a 21:1 contrast ratio โ€” the maximum possible. While that sounds ideal, it actually causes problems. The extreme luminance difference creates a "halation" effect where white text appears to bleed or glow against black, particularly for users with astigmatism (roughly 50% of the population). Use dark grays (#0a0a0b to #1a1a1a) and off-white text (#e8e8ed to #f0f0f0) for a contrast ratio around 15:1 to 17:1 โ€” still far above WCAG requirements but much more comfortable for extended reading.

Adjust Accent Colors for Dark Backgrounds

Saturated colors that work perfectly on white backgrounds often fail on dark ones. A rich blue (#2563EB) on white gives 4.6:1 โ€” just passing AA. But the same blue on #1a1a1a gives only 3.8:1 โ€” failing for normal text. The fix: use lighter, slightly desaturated tints for dark mode. Map #2563EB to #60A5FA and check again. Build both light and dark variants into your color palette from the start.

Elevation and Surface Hierarchy

In light mode, elevation is communicated through shadows (higher elements cast larger shadows). In dark mode, shadows are invisible against dark backgrounds. Instead, use progressively lighter surface colors: a base of #0a0a0b, cards at #111113, modals at #1a1a1c, and tooltips at #252529. Each level needs enough contrast with adjacent levels to be perceivable (a minimum of 1.5:1 between adjacent surfaces is a good starting point), while text on each surface must still meet 4.5:1.

Testing Dark Mode Specifically

Don't assume that if your light mode passes accessibility tests, your dark mode will too. Test every color combination in both modes. Pay extra attention to: muted/secondary text colors (they often drop below 4.5:1 in dark mode), colored badges and tags on dark surfaces, hover states (a subtle lightening on hover may not be perceptible enough), and border colors that separate dark surfaces from one another.

๐Ÿ“š Continue Reading

๐ŸŽจ Hue Pro coming soon
Brand guide builder, font pairing, mockup generator. Get early access.