Skip to content
All articles
AccessibilitySep 28, 2026

WCAG Contrast Without the Math Panic

Learn WCAG 2.2 contrast targets for text and controls, see why gray can fail on white, and check your own colors with worked examples.

5 min read

Three gray text samples on white, with contrast ratios of 4.48, 4.54 and 7.46 to one and their normal-text results.

For ordinary body text, the WCAG 2.2 AA contrast target is at least 4.5:1 against its background. Large text can use 3:1. Those are the two numbers to start with when checking a paragraph, a form label or a button caption.

You can measure a pair of colors in seconds. The part that needs judgment is choosing the right pair: a gray that works on white may fail on the pale background of a card. A passing result belongs to that combination, rather than to the gray by itself.

What a WCAG Contrast Ratio Measures

A contrast ratio compares the relative luminance of two colors. For opaque sRGB colors, it runs from 1:1, when their luminance is identical, to 21:1 for black against white. Different hues can still produce very little luminance contrast.

The calculation converts the red, green and blue channels into linear-light values before comparing them. You do not need to do that by hand: the VersatilBox contrast checker accepts a text color and a background color and calculates the ratio for you. The method comes from the W3C definitions of contrast ratio and relative luminance.

Use the tool on the actual color pair you intend to ship. Comparing two isolated swatches by eye is a useful design check, but it will not tell you whether their ratio clears a specific threshold.

WCAG AA and AAA Contrast Requirements

For text, the targets are:

  • AA, normal text: at least 4.5:1.
  • AA, large text: at least 3:1.
  • AAA, normal text: at least 7:1.
  • AAA, large text: at least 4.5:1.

These come from Contrast (Minimum), SC 1.4.3 and Contrast (Enhanced), SC 1.4.6.

“Large” has a defined meaning: at least 18pt, or 14pt in bold. In CSS, 18pt is 24px; 19px bold is a practical value above the 14pt threshold. A heading does not qualify just because it uses a heading tag, and a 16px button label is still normal text.

An “AAA” result in a color checker means the pair meets that contrast target. It does not certify a whole page as WCAG AAA. Keyboard access, text alternatives and the other applicable requirements still need their own checks.

Why #777777 Fails on White

Try these text colors against a solid #ffffff background:

  • #777777 → 4.48:1: below the AA target for normal text.
  • #767676 → 4.54:1: just above that target.
  • #555555 → 7.46:1: above the AAA target for normal text.
Aa Aa Aa
#777777 · 4.48:1 #767676 · 4.54:1 #555555 · 7.46:1

The enlarged samples make the shades easier to compare; the results above refer to using those colors for normal text. All three ratios were calculated from the W3C sRGB formula, then rounded to two decimal places for display.

The first two grays differ by only one step in each RGB channel. Their pass/fail results differ because one falls on each side of 4.5:1. This is why guessing from appearance is unreliable near the boundary.

Never round a failing ratio into a pass. W3C explicitly notes that 4.499:1 does not meet a 4.5:1 requirement. A little spare contrast is useful, especially with thin type that can look fainter after font smoothing. The darker example gives you more room than a pair sitting just above the minimum.

How to Check Text Contrast in Practice

Start with one piece of text on an actual page, then repeat for the other places that reuse its color.

  • Find the text color and its immediate background. A label inside a tinted card needs to be checked against that card.
  • Choose the relevant text target. Most body copy and form labels need the normal-text result.
  • Adjust the pair if it fails. Darken text on a light surface, or lighten it on a dark surface, then measure again.
  • Check the other appearances. Review the dark theme and hover states. Include helper text and placeholders.

For transparent text, the hex value alone does not describe the color readers see; account for the blending with its background. Text over a photo or gradient needs enough contrast wherever the letters appear. An opaque panel behind it can make that background predictable.

Buttons and Icons Need a Separate Check

A button caption follows the text requirements. Visual information needed to identify a control or its state follows a separate AA criterion: Non-text Contrast, SC 1.4.11, which requires 3:1 against adjacent colors. It also covers necessary parts of graphics.

For example, a checkmark that communicates a checkbox’s selected state needs sufficient contrast against the box. Its accompanying label needs the text check against the label’s background.

This does not mean every decorative border must reach 3:1. W3C distinguishes the visual information needed to recognize a control from optional decoration. A button can be identifiable through its visible text without needing a contrasting outline around its entire hit area.

Contrast Still Needs Clear Labels

A strong ratio does not explain what a color means. If a form marks errors only in red, someone who cannot distinguish that red still needs another visible cue. Write an error message beside the field. On a status badge, include “Failed” or “Complete” rather than relying on a colored dot.

That addresses Use of Color, SC 1.4.1. Color can reinforce the message while the words carry its meaning.

Choose one paragraph or control in your interface and check it today. Save the foreground and background together when the pair works, then check again whenever either color changes.

Check your text and backgroundEnter both hex colors to see their ratio and WCAG text contrast results.Check contrast →

More from the blog