Color Contrast Checker

Check WCAG contrast ratio for two colors with live AA/AAA pass-fail.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A WCAG color contrast checker that takes a text color and a background color and tells you the exact contrast ratio, then grades it against the AA and AAA thresholds for normal text, large text, and user-interface components. A live preview shows real headings, body copy, captions, and a bordered button rendered in your two colors, so you can see and measure readability at the same time. It is built for designers, developers, and accessibility reviewers who need a fast, trustworthy contrast number before shipping a palette.

How it works

Every color is parsed from hex (#rgb, #rrggbb, or 8-digit #rrggbbaa) or from an rgb() / rgba() string into red, green, and blue channels. Each channel is converted to linear light and combined into a relative luminance value using the official sRGB coefficients (0.2126 R, 0.7152 G, 0.0722 B). The contrast ratio is then (L_light + 0.05) / (L_dark + 0.05), which ranges from 1:1 for identical colors up to a hard ceiling of 21:1 for black on white.

When you reduce the foreground opacity, the tool first alpha-composites the text color over the background, because semi-transparent text never reaches its raw color on screen — it measures the blended result instead. The pass/fail matrix compares the final ratio to the five WCAG cutoffs (4.5, 3, 7, 4.5, and 3) and marks each as a pass or fail. If a pair fails AA, the suggest passing foreground button tries pure black or white against your background and applies whichever clears 4.5:1. You can swap the two colors, save tested pairs as swatches, and copy a plain-text report for your design notes or a pull-request comment.

Example

Suppose your brand uses a mid grey #767676 for captions on a white #ffffff background. The checker reports a ratio of about 4.54:1 — it scrapes past AA for normal text but fails AAA. Lighten the grey to #999999 and the ratio drops to roughly 2.85:1, which now fails AA entirely and would be illegible for many low-vision readers.

ForegroundBackgroundRatioAA normalAAA normal
#000000#ffffff21.0:1PassPass
#1a1a1a#ffffff17.4:1PassPass
#767676#ffffff4.54:1PassFail
#999999#ffffff2.85:1FailFail
#ffd500#00000016.4:1PassPass

Drop the captions to a darker grey and the same row flips to a comfortable AAA pass. Because the math runs live as you type, you can dial in the lightest shade that still clears your target level in seconds — and everything stays in your browser.

Ad placeholder (rectangle)