How to Fix Color Contrast Errors (WCAG 1.4.3 and 1.4.11)
To fix a color contrast error, darken the text color (or lighten the background) until the ratio reaches 4.5:1 for normal text, 3:1 for large text, and 3:1 for the borders, icons and focus rings that people need in order to use a control. Check the pair in a contrast checker, change the value in your CSS and test every state, including hover and focus. This guide shows real before and after examples.
Ratios in this guide were calculated with the WCAG relative luminance formula. Confirm your own colors with a checker.
What do WCAG 1.4.3 and 1.4.11 require?
| Content | Criterion | Minimum ratio |
|---|---|---|
| Normal text | 1.4.3 Contrast (Minimum) | 4.5:1 |
| Large text (18 pt or 14 pt bold, roughly 24 px or 18.66 px bold) | 1.4.3 Contrast (Minimum) | 3:1 |
| UI components and graphics needed to understand content | 1.4.11 Non-text Contrast | 3:1 |
Logos and purely decorative text are exempt. Inactive (disabled) controls are also exempt, though many teams still keep them legible. For more on reading ratios, see color contrast checkers and how to read 4.5:1 and 3:1.
How do you find contrast errors?
Run an automated scan first. WAVE, axe DevTools and Lighthouse all flag low-contrast text. In Chrome DevTools, inspect an element and open its color swatch to see the ratio and a pass or fail marker. See the best free accessibility testing tools.
Then check by hand what tools miss: text over images and gradients, hover and focus states, icons, input borders and charts.
How do you fix light grey text?
Light grey text on white is the most common failure.
Before (ratio 2.85:1, fails):
.meta {
color: #999999;
background: #ffffff;
}
After (ratio 7.0:1, passes):
.meta {
color: #595959;
background: #ffffff;
}
If #595959 is too dark for your design, #757575 gives 4.61:1 on white, which still passes for normal text. #767676 is the lightest plain grey that passes on white, at 4.54:1. Anything lighter fails.
How do you fix a brand blue link?
Before (ratio 3.29:1, fails for body text):
a {
color: #4a90e2;
}
After (ratio 6.29:1, passes):
a {
color: #1a5fb4;
text-decoration: underline;
}
Keep the underline for links inside text. If link color is the only thing that tells a link from the surrounding text, you also risk 1.4.1 Use of Color. An underline fixes that.
How do you fix a button with light text?
White text on a light amber button is a frequent brand problem.
Before (ratio 2.03:1, fails):
.btn {
background: #f5a623;
color: #ffffff;
}
After (ratio 8.59:1, passes):
.btn {
background: #f5a623;
color: #1a1a1a;
}
You can keep the brand color for the button background and change the text to a dark color. This is often easier than changing the brand color.
How do you fix a red error message?
Before (white text on red, ratio 4.23:1, fails for normal text):
.error-banner {
background: #e53935;
color: #ffffff;
}
After (ratio 5.62:1, passes):
.error-banner {
background: #c62828;
color: #ffffff;
}
Error messages should also not rely on color alone (1.4.1). Add text such as "Error:" or an icon.
How do you fix form field borders and placeholders?
Form fields trigger two criteria.
Input border (1.4.11). If the border is the only thing that shows where the field is, it needs 3:1 against the page.
Before (ratio 1.61:1, fails):
input {
border: 1px solid #cccccc;
}
After (ratio 3.45:1, passes):
input {
border: 1px solid #8a8a8a;
}
Placeholder text (1.4.3). Placeholder text counts as text and needs 4.5:1 if it carries information.
Before (ratio 2.85:1, fails):
::placeholder {
color: #999999;
}
After (ratio 4.61:1, passes):
::placeholder {
color: #757575;
}
A placeholder is not a replacement for a visible label. See how to make forms accessible.
How do you fix grey text on a grey background?
Contrast is measured against the actual background, not always white.
Before (#767676 on #f5f5f5, ratio 4.17:1, fails):
.card-note {
background: #f5f5f5;
color: #767676;
}
After (#6b6b6b on #f5f5f5, ratio 4.89:1, passes):
.card-note {
background: #f5f5f5;
color: #6b6b6b;
}
A color that passes on white can fail on a tinted background, so check every pair that appears in your design.
How do you fix text over images?
Tools struggle with images, so test by eye and with a sampled color. Options that work:
- Add a solid or semi-opaque overlay between the image and the text, and measure against the overlay color at the lightest part of the image.
- Put the text on a solid panel instead of directly on the picture.
- Choose or crop the image so the area behind the text is plain.
- Avoid text over busy areas or gradients that pass through the ratio threshold.
.hero-text {
background: rgba(0, 0, 0, 0.7);
color: #ffffff;
}
Check the result at the brightest part of the image, because the ratio changes across it.
How do you fix icons and focus rings?
Icons that carry meaning and focus indicators need 3:1 against their neighbouring colors (1.4.11).
:focus-visible {
outline: 3px solid #0b5fff;
outline-offset: 2px;
}
The blue #0b5fff has 5.13:1 on white. Check it against any dark or colored backgrounds you use too. For focus behavior, see 2.4.7 Focus Visible and 2.4.11 Focus Not Obscured (Minimum) in the WCAG 2.2 AA checklist.
How do you keep colors accessible across a design system?
Fix the tokens, not each page.
:root {
--text: #1a1a1a;
--text-muted: #595959;
--link: #1a5fb4;
--border-control: #8a8a8a;
--danger-bg: #c62828;
}
- Define text, muted text, link and control-border tokens that already pass.
- Test each token on every background it is used on, including dark mode.
- Do the same for hover, focus, selected and active states.
- Add a contrast check to your design handoff.
Kerbwise audits the page you have open against WCAG 2.2 Level A and AA and ranks accessibility issues by severity, with the WCAG number, who is affected and how to fix each one. Agencies can export the results as a PDF with their own logo. It is automated, so it will not catch every contrast problem, such as text over images, which you still need to check by eye.
Try Kerbwise on a page you own
Try Kerbwise ($29 one-time) to run this audit locally and export a client-ready PDF report. Get it on the Chrome Web Store or read more on the Kerbwise page.
Frequently asked questions
What contrast ratio do I need for text?
4.5:1 for normal text and 3:1 for large text at WCAG Level AA (1.4.3). For UI components and graphics, 3:1 (1.4.11).
How do I fix a contrast error without changing my brand colors?
Use the brand color for backgrounds or large elements and pair it with a dark or light text color that passes. You can also use a slightly darker version of the brand color for text and links.
Does placeholder text need to meet contrast requirements?
Yes, if it carries information. Placeholder text is text, so it needs 4.5:1. It should not replace a visible label.
Do disabled buttons need enough contrast?
Inactive controls are exempt from 1.4.3, though keeping them legible helps users understand what is disabled.
Is 4.4:1 close enough to 4.5:1?
No. The criterion sets 4.5:1 as the minimum, so adjust the color until the checker shows 4.5:1 or higher.