Color Contrast Checker

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

Free WCAG color contrast checker. Enter a text and background color to get the exact contrast ratio plus AA and AAA pass or fail results for normal and large text, with a live preview. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is a WCAG color contrast ratio?

It is a number from 1:1 to 21:1 that compares the relative luminance of two colors. Higher means more readable. WCAG 2.x defines minimum ratios so that text remains legible for people with low vision or color deficiencies. This tool computes the exact ratio using the official sRGB luminance formula.

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.