All articlesWhy Does My Site Fail WCAG Color Contrast Checks? Fixing Text, Buttons, and Backgrounds
12 min readHorizontal Impact

Why Does My Site Fail WCAG Color Contrast Checks? Fixing Text, Buttons, and Backgrounds

Why sites fail WCAG color contrast: the 4.5:1 and 3:1 rules, where buttons, hover states and gray text slip, and how to fix each one without a redesign.

Your site fails WCAG color contrast checks when the contrast ratio between text (or an essential UI element) and its background falls below WCAG's minimums: 4.5:1 for normal text, and 3:1 for large text and for the parts of buttons, form fields, and icons that people need to identify them. These failures are easy to miss because they hide in small places, like gray body text, button labels, placeholder text, and hover states, rather than in one obvious color choice.

If an audit flagged "insufficient color contrast" over and over, you're in large company. Low-contrast text tops the list of the six most common error types in the WebAIM Million, an annual automated scan of the top one million home pages. That makes it the first thing worth checking on your own site.

What counts as a WCAG color contrast failure?

A failure happens any time the contrast ratio between foreground and background drops below the threshold in WCAG Success Criterion 1.4.3 Contrast (Minimum) or 1.4.11 Non-text Contrast. These are pass/fail checks, measured with a formula rather than judged by eye. You can read the exact wording of both in the WCAG quick reference.

The ratio comes from the relative luminance of the two colors, on a scale from 1:1 (identical colors, no contrast at all) to 21:1 (pure black on pure white). WCAG sets different minimums depending on what you're looking at:

  • Normal text needs at least 4.5:1 against its background.
  • Large text, meaning at least 18 point, or 14 point bold, needs 3:1, since bigger letterforms are easier to tell apart with less contrast.
  • UI components and graphics need 3:1 under 1.4.11, which WCAG 2.1 added. That covers the visual information people need to identify a component and its state, such as a text field's border, a checkbox outline, or the icon in an icon-only button, plus the parts of charts and icons needed to understand the content.

Some text is exempt from 1.4.3. WCAG sets no contrast requirement for text in inactive (disabled) components, purely decorative text, text that isn't visible to anyone, text that's an incidental part of a picture with other significant visual content, or text that's part of a logo or brand name.

Here's the part people miss: the rule applies to every state a user can actually see and use, not just the default. Hover states, focus states, and placeholder text all need to clear the same thresholds. A button can pass in its default state and fail the moment you hover over it, because someone lightened the background in a design tool and nobody rechecked the numbers. Disabled controls are the one exception, since inactive components are exempt.

What does a contrast ratio of at least 4.5:1 mean in WCAG?

A contrast ratio of at least 4.5:1 is the minimum WCAG 2.1 Level AA requires for standard body text against its background. The phrase comes straight from 1.4.3, and it's the number behind "ADA color contrast requirements," because ADA settlements and U.S. Department of Justice guidance point to WCAG Level AA as the technical standard.

The threshold exists so that text stays readable for people with low vision, color vision deficiencies, or age-related vision loss. It also helps everyone else in poor conditions. Drop below it and legibility falls off fast, especially on a phone in direct sunlight or a cheap monitor with a washed-out panel.

A few reference points, each calculated with WCAG's formula:

Text colorBackgroundRatioNormal text (4.5:1)
#000000 (black)#FFFFFF (white)21:1Pass
#767676 (mid gray)#FFFFFF (white)4.54:1Pass
#777777 (one step lighter)#FFFFFF (white)4.48:1Fail
#999999 (light gray)#FFFFFF (white)2.85:1Fail

That's the trap. Light gray text on white looks clean and modern in a design file, and it fails in a real audit. The gap between passing and failing can be a single step in a hex code, and WCAG's thresholds are minimums: 4.48:1 isn't close enough.

Why does this happen so easily? Mostly design habits, not carelessness. Palettes get chosen for looks rather than luminance math, and a "secondary text" gray can get picked because it looks good next to the logo, with nobody checking it against WCAG until an audit flags it.

AA vs AAA contrast: what's the difference?

AA is the practical and legal baseline almost every site should target. AAA is stricter and best saved for content where readability is critical, such as health information, legal disclosures, or sites with a large low-vision audience.

ElementAA minimumAAA minimum
Normal text4.5:17:1
Large text3:14.5:1
UI components and graphics3:1No AAA tier

Chasing AAA across a whole site is admirable but often impractical. It tends to push a palette toward black and white, since many brand colors, like soft blues, pastel greens, and mid-tone reds, can't reach 7:1 against white without going nearly black. Our recommendation: meet AA everywhere, then push toward AAA on body copy in long-form content like articles and terms pages, where people read the longest.

Why do buttons fail contrast checks?

Buttons involve two contrast relationships at once: the label against the button's fill, and the button itself against the page. Design systems often check only the first one, and sometimes neither.

Brand guidelines usually set the button color before anyone thinks about label legibility. Picture white "Add to Cart" text on a light sage green like #8FA68E. It can look fine in a brand book on a high-end monitor, but the math says 2.62:1, well under the 4.5:1 text minimum. On a store, that's the button a customer has to find to buy anything.

Then check the second relationship. WCAG doesn't require every button to have a visible border. But if a boundary or fill is what tells people something is a control, like the outline of a text input or the shape of an icon-only button, that visual cue needs 3:1 against the colors next to it. A pale gray border on a white text field, for example, can vanish into the page and leave people unsure where to type.

The fix usually isn't abandoning the brand color. Darken it a little, or switch to dark text. Near-black text (#1A1A1A) on that same sage scores 6.64:1, and white text on a deeper sage like #5E7A5D scores 4.75:1. Either one passes.

How do you fix color contrast accessibility issues?

The fix itself is usually a small CSS change: swap a hex value and you're done. The hard part is finding every instance on a site that's built up years of design tweaks, rebrand color updates, and half-finished style guides. Once you've found them, the right fix depends on where the failure lives. The text contrast fix guide walks through the code-level fix for failing text.

Brand colors that don't pass

If a brand color fails, you have three real options: darken or lighten it slightly, make the text large and bold enough to qualify for the 3:1 large-text threshold, or keep the brand color for decoration and use a compliant shade for functional text.

Changing the brand color sounds drastic, but you rarely need a new one. A small shift in lightness is often enough to move a pair from failing to passing. Keep the vibrant shade for backgrounds and decorative accents. For anything with text sitting directly on it, such as buttons, banners, and alert boxes, use an adjusted shade that passes 4.5:1, or flip to dark text. A design system can hold two shades of the same color without looking inconsistent:

:root {
  --brand-sage: #8FA68E;      /* decorative accents only */
  --brand-sage-text: #5E7A5D; /* white text on this passes at 4.75:1 */
}

.button-primary {
  background-color: var(--brand-sage-text);
  color: #FFFFFF;
}

Putting colors in variables like this means one fix carries across every page that uses them, instead of hunting down each hard-coded hex value. We recommend fixing the underlying color values like this rather than relying on a "high contrast mode" toggle from an overlay widget, so every visitor gets passing contrast by default without having to find a switch.

Text over images and gradients

Text over photos or gradients is easy to get wrong, because the image changes brightness across its surface. A white headline might sit on a dark patch of sky in one spot and a bright cloud in another. Contrast has to hold across the whole area where the text can appear, not just the spot in the mockup.

The usual fix is a scrim: a semi-transparent dark (or light) layer between the image and the text, consistent enough that the ratio holds everywhere the text sits. A gradient that darkens the part of the image behind the headline works well:

.hero {
  background-image:
    linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0) 60%),
    url("hero.jpg");
}

Treat those values as a starting point, and tune the opacity until the lightest spot behind the text still passes. Don't skip this because the image "mostly" works. WCAG doesn't grade on a curve: if one zone behind the text drops below 4.5:1, that's a failure, even if the rest of the image passes.

Placeholder text, links, and interactive states

A few smaller patterns are easy to miss in design review:

  • Placeholder text in form fields. Light gray placeholder text often fails 4.5:1, and because it disappears once someone starts typing, it's easy to forget it exists. Darken it until it passes. On a white field, ::placeholder { color: #767676; opacity: 1; } clears 4.5:1, and setting the opacity keeps a browser's default fade from undoing the fix.
  • Links set apart by color alone. If a link is only a slightly different shade from the text around it, people with color vision deficiencies may not spot it. WCAG 1.4.1 Use of Color says color can't be the only visual way to distinguish an element, so the simplest fix is to underline links in body text.
  • Hover and focus states. It's easy to fix the default state and forget that hover and focus colors must clear the same bar. Check each state separately. If your focus outline is faint or has been removed with outline: none, the focus indicator fix guide shows how to bring it back.
  • Active buttons styled to look disabled. Disabled controls are exempt, but a faded gray button that's actually clickable isn't. If people can press it, it needs to pass.

How do you check contrast ratios on your own site?

You don't need to eyeball it or guess. A few methods work, depending on how deep you want to go:

  • Browser dev tools: Chrome, Firefox, and Edge show a contrast ratio in the color picker when you inspect a text element.
  • Browser extensions: WAVE and axe DevTools flag contrast failures directly on the rendered page and show the actual ratio next to the threshold it missed.
  • Manual contrast checkers: WebAIM's free contrast checker takes two hex codes and returns an instant pass or fail against AA and AAA.
  • Design-stage checks: Figma and most modern design tools have contrast plugins, so you can catch failures before anyone writes CSS, which is far cheaper than fixing them after launch.

Spot checks work for one button. They fall apart on a real site with dozens of pages, color variables pulled from a CSS framework, and a dark mode toggle. Checking every combination by hand is slow, and hover states are especially easy to miss because they only appear while you're interacting with the element.

That's where an automated scan helps, as long as you know its limits. AccessKnight's free scan, for example, checks the text and background colors declared in a page's HTML against the 4.5:1 and 3:1 thresholds and reports the ratio it found for each failure. Automated checks can miss hover states and text over photos, so pair any scan with a manual pass on interactive states and image overlays.

Does dark mode make this worse or better?

Dark mode doesn't inherently help or hurt contrast. It shifts where the failures happen. Pure white (#FFFFFF) on pure black (#000000) passes at 21:1, but some people with astigmatism find that bright text on a black background seems to glow or smear, an effect called halation.

WCAG's contrast criteria don't address halation, so it isn't a compliance issue. It's still worth designing for. An off-white like #E8E8E8 on a near-black like #121212 still scores 15.29:1, far above the minimum, and it's easier on the eyes for some readers.

Where dark mode causes real WCAG failures is in secondary elements, such as placeholder text, muted helper text, form field borders, and focus outlines, that were designed in light mode and then inverted without rechecking the math. A gray that passes on white can fail on near-black: #767676 scores 4.54:1 on white but only 4.12:1 on #121212. Check every pair again in each theme.

Does low contrast affect how AI tools read your page?

Mostly not directly, and it helps to separate two kinds of AI reader. Most AI crawlers read your HTML, where text color doesn't change what they extract, so fixing contrast on its own won't change what an answer engine knows about your page. Some AI tools also look at a page visually, from a rendered screenshot, and those face the same weak signal a person with low vision does: light gray text on a white card is harder to pick out accurately.

The bigger overlap is upstream. Contrast failures usually come from design decisions made without an accessibility pass, and skipping that pass can also leave structural problems, like unclear markup and content hidden with CSS tricks, that make a page harder for AI crawlers to parse and cite. The guide to AI readability covers what those crawlers need to see. While you're auditing colors, it's worth reviewing your headings and your image alt text in the same pass.

Where to start

Start with your buttons and primary calls to action, since those carry the most functional weight. List every text and background pair in your palette, including hover, focus, and placeholder colors, and run each one through a contrast checker against 4.5:1, or 3:1 for large text and component edges. Fix the failing hex values in your CSS variables so the change carries across the site. Then run a free AccessKnight scan on your homepage to catch the pairs you missed, and finish with a manual check of hover states and text over images.

Frequently Asked Questions

What is the minimum WCAG color contrast ratio?

Under WCAG 2.1 Level AA, normal text needs at least 4.5:1 against its background. Large text, meaning at least 18 point or 14 point bold, needs 3:1, and so do the visual parts of UI components and graphics that people need to identify or understand.

Do buttons and icons need to pass contrast checks too?

Yes. Button text needs 4.5:1 against the button's own fill, or 3:1 if it's large text. Under WCAG 1.4.11, any visual part needed to identify a control or its state, such as a field border, a checkbox outline, an icon, or a focus indicator, needs 3:1 against the colors next to it.

Is AAA contrast (7:1) required, or is AA enough?

AA is enough for most sites, and it's the level that ADA legal guidance and settlements reference. AAA requires 7:1 for normal text and 4.5:1 for large text, and it's worth pursuing on long-form reading content, but forcing it across a whole brand palette usually isn't practical.

Do disabled buttons and placeholder text have to meet contrast minimums?

Disabled, inactive controls are exempt from WCAG's contrast requirements. Placeholder text isn't exempt, so it needs 4.5:1 like other normal text. An active button that's only styled to look faded still has to pass.

Can you check color contrast without a browser extension?

Yes. Browser dev tools show a contrast ratio when you inspect a text element, WebAIM's free contrast checker tests any two hex codes, and design tools like Figma have contrast plugins. To check a whole live site rather than single color pairs, an automated scanner is faster.

Can you pass contrast checks and still have an accessibility problem?

Yes. Contrast is one of many WCAG success criteria, and keyboard access, alt text, form labels, and heading structure matter just as much. Passing contrast alone doesn't make a site accessible.

Fix guides for this topic

Step-by-step fixes with copy-paste code for the checks this article covers.

Check your website's accessibility

Scan against all 33 WCAG 2.1 rules and get code-level fix suggestions — free.

Run a free scan →

Keep reading