Color Contrast Checker

Check whether text is easy to read on its background, using the contrast rules in WCAG 2.2.

HEX, RGB, HSL or a color name

HEX, RGB, HSL or a color name

How it works

Enter the text color and the background color, by picking them or by typing any code (HEX, RGB, HSL or a name). The preview shows real text in both colors, and the contrast ratio appears straight away, from 1:1 (no contrast) to 21:1 (black on white).

The ratio is checked against the Web Content Accessibility Guidelines (WCAG 2.2): AA needs 4.5:1 for normal text and 3:1 for large text (24 px, or 19 px bold) and for icons, borders and buttons. AAA, the stricter level, needs 7:1 and 4.5:1.

When a pair fails AA, the tool suggests the closest text color and the closest background color that pass, keeping the same hue and changing only how light or dark it is. Tap a suggestion to use it.

Check it by hand: take grey #767676 on white. Each channel is 0x76 = 118, and 118 ÷ 255 = 0.4627. Linearised, that is ((0.4627 + 0.055) ÷ 1.055)^2.4 = 0.1812, and because all three channels are equal, 0.1812 is the relative luminance of the grey. White is 1. The ratio is (1 + 0.05) ÷ (0.1812 + 0.05) = 1.05 ÷ 0.2312 = 4.54, so the pair shows 4.54:1. That passes AA for normal text (4.5) but not AAA (7). Black on white is 1.05 ÷ 0.05 = 21, the highest possible.

Contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 of the darker one.

Worked example

Grey text #767676 on white has a ratio of 4.54:1, so it just passes AA for normal text. A lighter grey, #999999, has only 2.84:1 and fails, and the tool suggests a slightly darker grey that reaches 4.5:1.

Good to know

  • Ratios are cut, not rounded, to two decimals, so 4.499 shows as 4.49:1 and fails, as WCAG intends.
  • Contrast is one part of readability. Font size, weight and spacing matter too.
  • Semi-transparent text is blended onto the background before checking.

Questions people ask

What contrast ratio do I need?

For normal text, at least 4.5:1 (WCAG AA). For large text, and for icons and button borders, at least 3:1. AAA asks for 7:1 for normal text.

What counts as large text?

Text of at least 24 px (18 pt), or at least 19 px (14 pt) when bold.

Does this check WCAG 2.2?

Yes. The contrast rules are the same in WCAG 2.0, 2.1 and 2.2, which most accessibility laws, including the ADA in practice, refer to.

How do I fix a failing color pair?

Use one of the suggested colors. They keep your hue and change the lightness just enough to pass.

Is this the same formula WebAIM uses?

Yes. It is the relative luminance formula defined by WCAG, the same one used by WebAIM and browser developer tools.

What is the contrast ratio of black on white?

21:1, the highest possible. White has a luminance of 1 and black has 0, so the ratio is (1 + 0.05) ÷ (0 + 0.05) = 21.

Does light grey #999999 on white pass?

No. Its ratio is 2.84:1, below the 3:1 needed even for large text. The closest passing grey is #757575, which gives 4.60:1.

Part of the guide: Developer and design tools: QR codes, passwords, JSON, colors and timestamps

Formulas and text last checked on 2 October 2026. Everything is calculated in your browser, so nothing you enter is sent or stored. Spotted a mistake? Tell us and we will fix it.