Color Contrast Checker

Free color contrast checker. Compute the WCAG 2.1 contrast ratio between a foreground and background color and see whether it passes AA and AAA for normal and large text.

AI-ready Use this tool with AI

This tool has a free JSON API. Copy a prompt or skill below to use it with ChatGPT, Claude, or any AI agent — no API key needed.

API docs
Enter two hex colors above.

How color contrast checker works

Color contrast is how distinguishable text is from its background, measured as a ratio from 1:1 (no contrast) to 21:1 (black on white). The WCAG 2.1 standard defines thresholds: normal text needs a ratio of at least 4.5:1 (AA) or 7:1 (AAA), and large text (18pt or 14pt bold) needs 3:1 (AA) or 4.5:1 (AAA).

The ratio is computed from the relative luminance of each color, which accounts for how the human eye perceives red, green, and blue differently. This checker parses two hex colors, computes their relative luminances, and returns the contrast ratio plus pass/fail results for normal and large text at AA and AAA levels.

Enter a foreground (text) color and a background color. The tool shows the ratio, the WCAG pass/fail results, and a live preview of the text on the background. Use it to pick accessible color pairs for buttons, links, and body text, and to audit an existing design for accessibility compliance.

Frequently asked questions

What is a good contrast ratio?
WCAG 2.1 AA requires at least 4.5:1 for normal text and 3:1 for large text. AAA requires 7:1 for normal text and 4.5:1 for large text. The maximum possible is 21:1 (black on white).
What counts as large text?
At least 18pt (24px) regular, or 14pt (18.66px) bold. Large text has a lower contrast threshold (3:1 at AA) because larger or bolder text is easier to read at lower contrast.
Does the order of colors matter?
No. The ratio is based on the lighter and darker luminance, so foreground and background can be swapped without changing the result. What matters is that one is text and the other is the background.
Can I use 3-digit hex shorthand?
Yes. #000 is treated as #000000 and #fff as #ffffff, the same as in CSS. The checker also normalises the output to a 6-digit lowercase hex.