Account

What new tool do you want?

Developer Tools

Color Contrast Checker (WCAG)

Check text and background colors against WCAG 2.2 AA and AAA contrast requirements — with a live preview and a suggested fix when a pair fails.

How to use

  1. 1Pick or paste the text color and the background color.
  2. 2See the contrast ratio and pass/fail for normal text, large text and UI components. Use the suggested color if it fails.

How it's calculated

Contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L is the relative luminance of the lighter (L1) and darker (L2) color. AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1 and 4.5:1.

Frequently asked questions

What counts as large text?

At least 18.66 px (14 pt) bold, or 24 px (18 pt) regular.

Do buttons and icons need contrast too?

Yes — WCAG 1.4.11 asks for 3:1 for UI components and meaningful graphics against adjacent colors.

Is passing contrast enough for accessibility?

It's one important part. Don't rely on color alone to convey meaning, and test with real users where possible.

What the ratio is actually measuring

Contrast ratio compares the relative luminance of the lighter and darker colors — (L1 + 0.05) ÷ (L2 + 0.05) — using the WCAG formula that weights green more heavily than red or blue, matching how human eyes perceive brightness. WCAG AA requires 4.5:1 for normal text and a lighter 3:1 for large text (18.66px bold or 24px regular and up), because bigger strokes stay legible at lower contrast; AAA raises those to 7:1 and 4.5:1 for readers who need more.

Worked example: gray text on white

The default pair — #6b7280 (a common "muted text" gray) on white — comes out to 4.83:1. That clears AA for normal text (4.5:1), AA/AAA for large text (3:1 / 4.5:1), and the 3:1 UI-component threshold, but falls short of AAA for normal text (7:1). For that one failing check, the tool suggests #545964 — the closest color to the original that reaches 7:1.

The suggested fix keeps your hue, only shifts lightness

Rather than swapping in some unrelated "accessible" color, the fix scans your foreground's hue and saturation across every lightness value from 0–100% and returns whichever one is closest to the original that clears the target ratio — so a brand blue stays recognizably blue, just darkened or lightened the minimum amount needed. Semi-transparent foreground colors are composited over the chosen background first before measuring, since a translucent color's effective contrast depends entirely on what's behind it.

Passing the ratio isn't the finish line

WCAG 1.4.11 also requires 3:1 contrast for meaningful UI components and graphics against their adjacent colors, not just body text against its background — which is why the tool checks a button outline alongside the paragraph text. Even a perfect ratio doesn't guarantee accessibility on its own: color should never be the only way information is conveyed, and real user testing catches issues a contrast formula can't.

Why green moves the ratio more than blue does

Before the weighted sum (0.2126 × red + 0.7152 × green + 0.0722 × blue) is applied, each channel is first converted from its 0–255 sRGB value into linear light using a gamma curve — values below a small threshold are divided by 12.92, everything else goes through ((c + 0.055) / 1.055)^2.4 — because sRGB values aren't perceptually linear to begin with. The 0.7152 weight on green reflects that the human eye is far more sensitive to green light than to red or blue at equal physical brightness, which is why swapping a color's green channel changes the contrast ratio much more than an equivalent change to its blue channel, even though both look like "the same amount" of color change on a color picker.

Related tools

More: Developer Tools