Contrast checker

Enter a text colour and a background colour as HEX codes. You get the contrast ratio from 1:1 to 21:1 and a pass or fail for each WCAG 2 level.

Normal text looks like this.Large text looks like this.

Contrast ratio

4.48 : 1

Normal text · AA (4.5:1)Fail
Normal text · AAA (7:1)Fail
Large text · AA (3:1)Pass
Large text · AAA (4.5:1)Fail
Graphics and interface parts · AA (3:1)Pass

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter the text colour and the background colour, as HEX codes or with the pickers.
  2. Read the ratio and the pass or fail table. The preview shows both sizes of text.
  3. Use Swap colors to check the reverse, such as light text on a dark background.

The formula

WCAG 2 defines relative luminance as L = 0.2126 R + 0.7152 G + 0.0722 B, where each channel is first converted from sRGB to linear light. The contrast ratio is (L1 + 0.05) / (L2 + 0.05), with L1 the lighter colour. Black on white is 21:1 and identical colours are 1:1.

Level Normal text Large text
AA 4.5:1 3:1
AAA 7:1 4.5:1

Interface parts and meaningful graphics need 3:1 for AA.

Example

Grey #777777 on white: luminance of the grey is about 0.184, so the ratio is 1.05 / 0.234 = 4.48. It passes for large text, but fails AA for normal text.

Tips

  • Contrast is not the only accessibility need: do not rely on colour alone to convey meaning.
  • Text over images or gradients needs checking at its worst spot.
  • WCAG 2 contrast is a simple measure and has known weaknesses with dark mode and thin fonts; treat it as a minimum.

Frequently asked questions

What contrast ratio do I need?

WCAG 2 level AA asks for at least 4.5:1 for normal text and 3:1 for large text. Level AAA asks for 7:1 and 4.5:1. Graphics and interface component boundaries need 3:1 under AA.

What counts as large text?

In WCAG, text of at least 18 points (24 CSS pixels) or at least 14 points (about 18.66 CSS pixels) in bold.

Why does 4.48 fail when it looks like 4.5?

The thresholds are applied to the exact ratio, with no rounding up. Grey #777 on white is 4.478:1, shown as 4.48, which is below 4.5 and so fails AA for normal text. #767676 is the lightest grey on white that passes.

How is the ratio calculated?

Each colour gets a relative luminance from its linearised sRGB channels (0.2126 R + 0.7152 G + 0.0722 B). The ratio is (lighter + 0.05) divided by (darker + 0.05).

More in Color

All tools in this category: Color ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.