Skip to content
Jellykit

Contrast Checker

Check the WCAG 2 contrast ratio of a text and background color, with AA and AAA results and the nearest colors that pass.

  • Runs on your device
Loading tool

About Contrast Checker

Enter a text color and a background color in any CSS notation and see their WCAG 2 contrast ratio, with a pass or fail for normal text, large text and interface parts at levels AA and AAA.

When a pair falls short, the tool suggests the nearest text color and the nearest background that would pass, keeping the hue and changing only lightness, so the fix still looks like your brand. Translucent colors are measured as they would actually be painted.

How it works

  1. Each color is read as CSS and converted to sRGB. A translucent text color is painted over the background, and a translucent background over a white page, before anything is measured.
  2. The relative luminance of each color is computed with the WCAG 2 formula, and the ratio is (lighter + 0.05) divided by (darker + 0.05), from 1 : 1 to 21 : 1.
  3. The ratio is compared with 4.5 and 7 for normal text, 3 and 4.5 for large text, and 3 for interface parts and graphics. It is cut, never rounded up, to two decimals.
  4. Suggestions move the color along OKLCH lightness, keeping its hue and as much chroma as the screen can show, and stop at the first 8-bit hex color that really passes.

Questions

What counts as large text?

WCAG defines large text as at least 18 point (24 CSS pixels) at regular weight, or at least 14 point (about 18.7 CSS pixels) in bold. Large text needs 3 : 1 for AA and 4.5 : 1 for AAA.

Why does a suggestion say it is not reachable?

Some targets cannot be met by changing one color alone. Against a mid grey, for example, neither black nor white text reaches 7 : 1. Try changing the other color instead, or both.

Does this check the newer APCA contrast method?

No. It reports the WCAG 2 contrast ratio, which is the measure current accessibility law and audits refer to. APCA is a draft for a future version and gives different numbers.

Are my colors sent anywhere?

No. Everything is calculated in your browser. The two colors are kept in the page address only so that you can share a link to the same check.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.