← All tools

Color contrast checker (WCAG)

Pick a text color and a background color to see the contrast ratio and the WCAG criteria at once. It runs in your browser and nothing is sent to a server.

Type HEX (#3b82f6), rgb(), hsl() or a color name (blue). Click any swatch below to select that color.

Tints and shades

Complementary color

Analogous colors

Triadic harmony

Why contrast matters

Light grey text can look stylish on white, but it becomes unreadable on a phone in sunlight, at low screen brightness or for someone with low vision. A large share of people live with some form of visual impairment or color blindness, and contrast sensitivity drops with age. Enough contrast makes a site readable for everyone.

It is not just good practice but a legal requirement in many places: the European Accessibility Act in the EU and ADA cases in the US expect websites to meet WCAG criteria.

The WCAG criteria

WCAG 2 level AA asks for at least 4.5:1 contrast for normal text and 3:1 for large text (about 24 pixels, or 18.7 pixels bold). Level AAA is stricter: 7:1 for normal text and 4.5:1 for large text. Non-text interface parts such as button borders, form fields and icons need 3:1.

The ratio runs from 1:1 (the same color) to 21:1 (white on black). On a white background, grey #767676 is about 4.5:1, right at the AA limit; any lighter grey is too weak for normal text.

Fixing contrast

If the ratio is too low, darkening the text or lightening the background usually does it; to keep the hue, change only the lightness in HSL. If your brand color itself is too weak for text, use it for large headings, button backgrounds or decoration instead. If the text color is semi-transparent, the tool blends it over the background and checks the color you actually see. All calculations run in your browser.

How to use it

  1. Choose the text color and the background color or type their codes.
  2. The contrast ratio and the preview update at once.
  3. In the table, see whether AA and AAA pass for normal text, large text and UI components.

Frequently asked questions

How is the contrast ratio calculated?

The relative luminance of each color is calculated, then the ratio (luminance of the lighter color + 0.05) / (luminance of the darker color + 0.05) is found. The ratio ranges from 1:1 (same color) to 21:1 (black on white).

What ratios does WCAG require?

For WCAG 2 AA, normal text needs at least 4.5:1 and large text at least 3:1. For AAA, normal text needs 7:1 and large text 4.5:1. For non-text UI components (button borders, icons) at least 3:1 is recommended.

What counts as large text?

In WCAG, text of at least 18 point (about 24 pixels), or at least 14 point (about 18.7 pixels) when bold, counts as large.

How are semi-transparent colors handled?

If the text color is semi-transparent it is blended over the chosen background and the ratio is calculated for the resulting opaque color.

Related guide

Related tools