DesignMay 18, 2026

Color Contrast and WCAG: A Developer's Guide to Accessible Design

What WCAG contrast ratios mean, how to calculate them, which UI elements are exempt, and how to fix low-contrast designs without losing your brand palette.

Olivia Bennett
Olivia Bennett · Full-stack Developer
Full-stack developer focused on developer tooling and web performance. Writes about the formats, patterns, and shortcuts devs reach for every day.
accessibilitywcagdesigncolora11y

Why Contrast Ratios Matter

Around 300 million people worldwide have color vision deficiency. A further 2.2 billion have near or distance vision impairment. For these users — and for everyone reading a screen in bright sunlight — low-contrast text becomes illegible long before it disappears entirely.

Color contrast is one of the most objectively measurable aspects of web accessibility. It does not require assistive technology, specialized testing environments, or interpretation. You can calculate it precisely from two hex codes and compare the result against a defined threshold. That makes it both easy to test and easy to enforce.

The Web Content Accessibility Guidelines (WCAG) define contrast requirements across two conformance levels. Meeting them is a legal requirement in many jurisdictions — including under the ADA in the United States, the European Accessibility Act, and similar legislation in the UK, Canada, and Australia.


Understanding the Contrast Ratio

The WCAG contrast ratio is a number between 1:1 (no contrast — same color on same color) and 21:1 (maximum contrast — pure black on pure white). It is calculated from the relative luminance of each color.

Relative luminance is not the same as perceived brightness or the L channel in HSL. It is a measure of how much light a color reflects, calculated from its RGB values using a linearization formula that accounts for how human vision processes light non-linearly.

For two colors with relative luminance L1 (lighter) and L2 (darker):

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

The 0.05 offset prevents division by zero and approximates the ambient light environment of a typical screen.

You do not need to calculate this by hand. Paste the foreground and background hex values into the Color Contrast Checker to get the exact ratio and pass/fail results instantly.


WCAG Conformance Levels: AA vs AAA

WCAG defines two relevant contrast levels for visual content:

Level AA (Minimum Acceptable)

  • Normal text (under 18pt / under 14pt bold): contrast ratio of at least 4.5:1
  • Large text (18pt or larger / 14pt bold or larger): contrast ratio of at least 3:1
  • UI components and graphical objects: contrast ratio of at least 3:1 against adjacent colors

Level AA is the standard target for legal compliance and the default requirement in most accessibility audits. Most WCAG 2.1 AA certifications require every text element on the page to meet this threshold.

Level AAA (Enhanced)

  • Normal text: contrast ratio of at least 7:1
  • Large text: contrast ratio of at least 4.5:1

Level AAA is aspirational — WCAG explicitly states that meeting AAA for all content is not always possible and is not required for conformance. It is most relevant for applications where users may have severe visual impairments, such as healthcare portals or government services.


What "Large Text" Actually Means

The AA threshold for large text (3:1) is more permissive than for normal text (4.5:1), but the definition of "large text" is specific: 18pt (24px at 96 DPI) or larger, or 14pt bold (approximately 18.67px bold) or larger.

This is a computed font size, not a perceived one. A fluid font that renders at 22px on mobile is large text. The same font at 16px is not.

In CSS, the typical cutoff is:

  • font-size: 24px and above → large text (3:1 threshold)
  • font-size: 18.67px and above with font-weight: 700 → large text (3:1 threshold)
  • Everything else → normal text (4.5:1 threshold)

Browser DevTools shows the computed font size for any element in the Styles panel.


What Is Exempt from Contrast Requirements

Not everything on a page must meet contrast ratios. WCAG explicitly exempts:

  • Disabled UI elements — buttons or inputs with disabled attribute or visually styled as disabled. The assumption is that users cannot interact with them anyway.
  • Decorative images and background patterns — images that convey no information and are not referenced by text.
  • Logos and brand marks — the specific colors in a company logo are exempt. The company name rendered as styled text is not exempt even if it uses brand colors.
  • Incidental text — text in a photograph that is incidental to the content (a sign in the background, text on a product in an image).
  • Inactive components — elements that are not available for user interaction, such as greyed-out menu items.

These exemptions give design teams flexibility for decorative and branding elements while ensuring that functional and informational text remains accessible.


Common Contrast Failures in Real Designs

Light grey text on white

The most pervasive failure. #999999 on white produces a contrast ratio of 2.85:1 — well below the 4.5:1 threshold. It is widely used for secondary text, placeholders, and captions. To meet AA:

  • #767676 on white = 4.54:1 ✅ (barely passes)
  • #696969 on white = 5.07:1 ✅ (safe)
  • #595959 on white = 7.00:1 ✅ (passes AAA)

Colored text on colored backgrounds

Blue text (#0070F3) on a light blue background (#EBF5FF) produces a ratio of around 4.1:1 — just below AA threshold. Brand colors often fail when layered over tinted versions of themselves.

Placeholder text in form inputs

Placeholder text is typically rendered in a grey that passes contrast visually but fails WCAG. The solution is to use a color that passes the 4.5:1 threshold for normal text. Avoid using placeholder text as a replacement for labels — it disappears as soon as the user starts typing.

Icon-only buttons with low contrast

An icon with a stroke color of #BBBBBB on a white background does not meet the 3:1 UI component threshold. Even if the icon is meaningful to sighted users, low-contrast icons are invisible to users with contrast sensitivity issues.


Testing Contrast in Practice

Browser DevTools: Chrome DevTools flags low-contrast text in the Elements panel with an accessibility warning. Hover over an element, click the color swatch in the Computed styles, and the tooltip shows the contrast ratio and whether it passes AA or AAA.

axe DevTools: The free axe browser extension runs a full WCAG audit and reports every contrast failure on the page with specific element locations, computed ratios, and recommended fixes.

Figma: The Figma Accessibility plugin (and several third-party plugins like A11y Annotation Kit) show contrast ratios for selected text layers. Many design teams check contrast during design review before any code is written.

Online checker: Paste your foreground and background hex codes into the Color Contrast Checker to instantly verify both AA and AAA compliance and see the exact ratio.


Fixing Low-Contrast Designs Without Losing Your Brand

The most common objection to contrast improvements is "it will change our brand colors." In practice, small adjustments to lightness preserve hue identity while improving contrast:

  1. Darken text colors, not background colors. A small increase in text darkness is far less noticeable than a large increase in background contrast. Move text from #999999 to #767676 — the hue stays grey, but contrast jumps from 2.85:1 to 4.54:1.

  2. Use the HSL color model. Convert your hex color to HSL using the Color Converter, then adjust only the L (lightness) value until contrast passes. This preserves the hue and saturation perfectly.

  3. Add a semi-transparent overlay to text on images. Text over photographs rarely passes contrast because the background brightness varies. A rgba(0,0,0,0.5) overlay under white text creates a reliable dark background while still allowing the image to show through.

  4. Increase font weight instead of darkening color. At 14pt bold and above, only the 3:1 threshold applies. Making a heading bold can bring a borderline 3.5:1 ratio into compliance without touching the color.


WCAG 2.1 vs WCAG 3.0 (APCA)

WCAG 2.1 contrast ratios, while widely adopted, have a known limitation: they treat all hues with the same luminance equally, but human vision is not equally sensitive to all colors. Yellow and blue text at the same mathematical contrast ratio are not equally readable.

WCAG 3.0 introduces APCA (Advanced Perceptual Contrast Algorithm), which accounts for:

  • Polarity (light text on dark vs dark text on light)
  • Font size and weight
  • The specific colors involved (not just their luminance)

APCA is still in draft as of 2026. For production sites, WCAG 2.1 AA (4.5:1 for normal text) remains the standard for compliance and legal purposes. APCA is worth watching for future-proofing your design system.


Quick Reference: Pass/Fail Thresholds

Content type Level AA Level AAA
Normal text (< 24px, not bold) 4.5:1 7:1
Large text (≥ 24px or ≥ 18.67px bold) 3:1 4.5:1
UI components (borders, icons) 3:1 not specified
Disabled elements exempt exempt
Logos exempt exempt

Use the Color Contrast Checker to test any color combination against these thresholds. Enter the foreground color, background color, and the tool shows the exact ratio, AA result, and AAA result immediately.

← All guides