How to check and fix color contrast on your website Discover

How to Check and Fix Color Contrast on Your Website

A placeholder can look legible in a design file and almost disappear in the live form. The difference might be a single style rule: the browser is applying the intended gray at reduced opacity. Choosing a darker gray without checking that rule could fix the placeholder on one page while making every other field label darker than intended.

If you’re working out how to fix color contrast on your website, start with the element a visitor needs to read or recognize. Measure it against its actual background, find the style responsible for the result, and verify the change in the same state in which it failed.

Know which contrast ratio you need

Know which contrast ratio you need

A contrast ratio compares the relative luminance of two colors. Identical colors have a ratio of 1:1; black and white have a ratio of 21:1. The ratio belongs to the pair, not to either color individually. A blue that works for link text on white may fail on a tinted notification panel.

For a WCAG 2.2 Level AA review, distinguish between text and non-text information:

  • Ordinary text: Aim for at least 4.5:1 between text and its background. This includes field instructions, placeholder text and text inside active buttons.
  • Large text: The minimum is 3:1 for text that is at least 18 points (24 CSS pixels), or at least 14 points (about 18.67 CSS pixels) and bold. A heading does not qualify just because it is marked up as a heading.
  • Meaningful graphics and controls: Visual information needed to identify a control, its state or an essential part of a graphic generally needs 3:1 contrast against adjacent colors. This does not mean every decorative border needs 3:1 contrast.

Consider a white search field on a white page. If its outline is the only visible cue showing where to enter text, test the outline against the adjoining surface. Then test the text inside the field separately. A passing outline does not make pale input text readable. Conversely, an inactive control is exempt from these contrast minimums; don’t apply that exemption to an active button just because it looks disabled.

Check the colors visitors actually see

Check the colors visitors actually see
  1. Start with a task, not a palette. Open a page where someone needs to do something: submit an inquiry, choose cookie preferences or complete a purchase. Follow the task far enough to reveal instructions, validation messages and confirmation screens.
  2. Scan the page, then inspect the flagged element. Use an accessibility checker to locate likely failures. In your browser’s developer tools, inspect the element’s computed text color, background, font size and weight. If the background is transparent, look at the surface behind it. Check whether a parent element reduces opacity.
  3. Measure the rendered pair. Enter the foreground and background values into a contrast checker. Account for transparency rather than testing the opaque source colors. When sampling a screenshot, avoid the softened edges of letters; those pixels blend the text and background and are not the specified text color.
  4. Repeat in other states. Use the keyboard to focus the control, hover over it, select it and trigger an error where relevant. Check supported themes and narrow layouts. A mobile image crop, for example, can put a white headline over sky instead of trees.

Record enough detail for another person to reproduce the issue: page, component, state, theme, measured ratio and required ratio. “Email hint text on white, visible after the field receives focus” is a more useful ticket than “form contrast is low.”

Fix the color pair without creating another failure

For muted text, change the style that owns the problem

Suppose the helper text beneath an email field uses #999999 on white. Its contrast is about 2.85:1, below the 4.5:1 minimum for ordinary text. Changing the text to #666666 on the same white background gives about 5.74:1. You can keep the helper text visually secondary through placement and spacing without making the instructions difficult to read.

Before changing a shared gray, check where else it is used. If all secondary text on light surfaces uses the failing pair, correct that shared text style. If only this form fails because its container has reduced opacity, fix the container instead. Recheck the resulting value rather than rounding a near miss up to a pass: 4.49:1 is below 4.5:1.

For buttons and links, separate the label from the state

If white button text fails on a bright brand color, try a dark label on the existing fill before changing the brand color across the site. Alternatively, use a darker fill for that button. Measure the label again in its hover and pressed states; a lighter hover fill can undo a fix that works at rest.

Also ask what tells visitors the element is interactive. A link can meet the text contrast requirement against the page and still be hard to distinguish from the surrounding sentence. A persistent underline gives readers a cue that does not depend on color. Similarly, pair a red field outline with a written error that explains what to correct.

For photos and gradients, stabilize the background

Don’t measure a headline against the average color of a photograph. Look at the background directly behind the letters, especially where the image is closest in brightness to the text. If editors can replace the image or the crop changes with screen width, a passing result for one screenshot is fragile.

Placing the text on a solid panel gives you a predictable pair to test. If the design needs an overlay, measure the resulting background in the lowest-contrast area behind the text at each supported crop. Moving the headline outside the photo is also a good fix when the overlay would obscure the subject.

Verify the fix and keep evidence

Verify the fix and keep evidence

Retest the original failure first. Use the same page, viewport, theme and interaction state, and record the new ratio. Then check another instance of the component on a different surface. A corrected form hint might pass on the white contact page but fail inside a tinted signup panel. If you changed a shared style, include both instances in the review.

For design and compliance teams, the most useful handoff is a list of approved pairings: secondary text on the default surface, button label on the primary fill, and error text on the error panel. Include the states each pairing was tested in. That gives designers a usable choice and gives reviewers a reference when a future release changes a color.

Corpowid’s AI accessibility auditing can help teams identify issues on websites and in Figma designs, while real-time accessibility monitoring helps track findings after release. When evaluating that workflow, bring a component you have already tested manually. Compare the findings with your recorded measurements, and keep manual checks for image backgrounds and interaction states that need visual inspection.

Frequently asked questions

Does every color in my brand palette need to pass on white?

No. Test colors according to their use. A pale accent can work as a decorative fill even if it fails as small text on white. Document an approved text color for that fill so editors know which combination to use.

Can I fix low contrast by making text bold?

Bold alone does not change the contrast ratio. Size and weight determine whether text qualifies for the large-text threshold. For ordinary body copy that falls short, change the foreground or background rather than relying on bold styling.

Does a clean automated scan mean the page passes?

No. A scan is a starting point. Open menus, trigger errors and inspect text over imagery to check conditions the scan may not have evaluated. Passing contrast checks also does not establish WCAG 2.2 conformance for the page as a whole.

Corpowid is recognized by Gartner

Corpowid has been recognized by Gartner, a leading global research and advisory firm, for our innovation and performance in digital accessibility. These badges reflect our commitment to creating inclusive, AI-powered web experiences.

Have questions about Corpowid?

Let’s connect.

We will get back to you as soon as possible.