- color contrast
- WCAG
- accessibility
- how-to
Color Contrast: How to Check and Fix It on Your Website
What WCAG 1.4.3 requires for color contrast (4.5:1 and 3:1), how to check your colors in minutes, and simple ways to fix text that fails.
On this page
Light gray text on a white background might look sleek on a designer's big monitor. For a visitor with low vision, or anyone reading a phone in bright sun, it can be nearly impossible to read.
Low contrast text is the single most common accessibility failure found on home pages in the WebAIM Million report. It also shows up in the Justice Department's list of common website barriers, which notes that sufficient contrast helps people with limited vision or color blindness read text.
The fix is usually simple: change a color. This guide shows you how to check your site and what to change.
This is not legal advice. Fixing contrast makes your site easier to read, but no single fix guarantees compliance or prevents a legal claim. If you have received a demand letter, talk to an attorney.
What WCAG requires
The Web Content Accessibility Guidelines cover text contrast in success criterion 1.4.3, Contrast (Minimum), at Level AA. According to the W3C's Understanding 1.4.3:
- Normal text needs a contrast ratio of at least 4.5:1 against its background.
- Large text needs a contrast ratio of at least 3:1.
What counts as "large text"?
WCAG defines large-scale text as at least 18 point, or 14 point bold. The W3C's Understanding page says those are equivalent to about 24px and 18.5px in web (CSS) pixels. Most body text on websites is 16px, so it counts as normal text and needs 4.5:1.
What's a contrast ratio?
It's a number that compares how light the text is to how light the background is. Ratios run from 1:1 (same color, invisible) to 21:1 (black on white). Higher is easier to read.
No rounding up
The W3C says computed ratios "should not be rounded (e.g., 4.499:1 would not meet the 4.5:1 threshold)." If a checker shows 4.48:1 for normal text, it fails, even though it's close.
What's exempt
WCAG 1.4.3 doesn't apply to everything. Per the W3C, there is no contrast requirement for:
- Logos: "Text that is part of a logo or brand name has no contrast requirement."
- Inactive controls, such as a grayed-out button that can't be clicked yet
- Pure decoration or text no one can see
- Text that is incidental in a picture that contains significant other visual content, such as a street sign in the background of a photo
Buttons, icons and form borders
A separate criterion, 1.4.11 Non-text Contrast (Level AA, added in WCAG 2.1), asks for a contrast ratio of at least 3:1 for the visual parts of interface components and meaningful graphics. That includes things like form field borders and icons that carry meaning.
How to check your contrast in five minutes
Step 1: Find your colors
You need the hex codes (like #767676) for your text and background colors. Places to look:
- Your website builder's theme or style settings
- Your brand guide, if you have one
- Your browser's developer tools: right-click the text, choose "Inspect," and look for
colorandbackground-color
Focus on the text people read most: body text, menu links, button labels, form placeholders, and footer text. Footers and light gray "fine print" are common trouble spots.
Step 2: Run them through a checker
The WebAIM Contrast Checker is a simple web tool. Enter a foreground and background color, and it shows the contrast ratio and whether it passes for normal text, large text, and graphical objects and interface components.
Step 3: Check the tricky spots
Some places a single pair of colors can't tell the whole story:
- Text on photos. Contrast changes across the image. Check the lightest part behind the text.
- Hover and focus states. A link that changes color on hover still needs to be readable.
- Placeholder text inside form fields, which is often very light gray
- Disabled-looking text that is actually active and clickable
Step 4: Scan the whole page
Checking colors one pair at a time is slow. An automated scan can flag low-contrast text across a page in one pass. It may not judge text on images or gradients reliably, so check those by eye.
Real examples
These ratios were calculated using the WCAG contrast formula. You can confirm any of them in the WebAIM checker.
#aaaaaagray text on white: 2.32:1. Fails for normal and large text.#777777gray text on white: 4.48:1. Fails for normal text (remember, no rounding). Passes for large text.#767676gray text on white: 4.54:1. Passes for normal text, just barely.#555555gray text on white: 7.46:1. Passes comfortably.- White text on an orange
#f5a623button: 2.03:1. Fails, even for large text.
Notice how small the difference between #777777 and #767676 is. You often don't need to change your look much. A slightly darker shade can be enough.
How to fix contrast problems
Darken the text (or lighten the background)
This is the most common fix. Nudge the text color darker until the checker shows a pass. The WebAIM checker includes a lightness slider that helps you find the nearest passing shade.
/* Before: 2.32:1, fails */
p { color: #aaaaaa; background: #ffffff; }
/* After: 7.46:1, passes */
p { color: #555555; background: #ffffff; }
Fix buttons in your brand color
If white text on your brand color fails, you have a few options:
- Use a darker shade of the brand color for buttons
- Use dark text on the light brand color instead of white
- Keep the bright brand color for decorative accents, where 1.4.3 doesn't apply
Add an overlay behind text on photos
For text on top of a photo, add a solid or semi-transparent dark band behind the text, or move the text off the image.
.hero-text {
color: #ffffff;
background: rgba(0, 0, 0, 0.7);
padding: 1rem;
}
Check the result with a checker, since the photo behind still affects contrast.
Don't use color alone to carry meaning
Contrast is one color rule. Another is WCAG 1.4.1 Use of Color (Level A), which says color should not be "the only visual means of conveying information." For example, marking required form fields only in red leaves out people who can't tell red apart. Add a word or symbol too, like "(required)."
Fix it at the source
Change colors in your theme or stylesheet, not page by page. One change to a theme color can fix the problem everywhere it appears.
A word about "contrast toggle" widgets
Some accessibility widgets add a button that lets visitors switch to a high-contrast mode. That doesn't change the colors your site shows by default, which is what most visitors see. Read Do Accessibility Overlay Widgets Make Your Website ADA Compliant? for more on why fixing the actual code matters.
Find your low-contrast text
Run a free scan of your homepage to see which text fails contrast checks, with the colors involved and a plain-English explanation.
Contrast is just one of the common problems. See The 10 Most Common Website Accessibility Problems (and How to Fix Them), or get the bigger picture in WCAG 2.1 AA Explained for Small Business Owners.
If a demand letter mentioned color contrast on your site, the Demand Letter Response Kit gives you a full scan of up to 5 pages, a dated PDF report for your attorney, and a fix guide your web person can follow.