Color contrast checker

Enter a text and a background color to get the WCAG contrast ratio and pass/fail for AA and AAA.

contrast ratio
UseAAAAA

How contrast ratio is calculated

Each color is converted to relative luminance L: channels are linearised (c ≤ 0.04045 ? c/12.92 : ((c+0.055)/1.055)^2.4) and weighted 0.2126 R + 0.7152 G + 0.0722 B. Then:

ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05)

The result runs from 1:1 (identical) to 21:1 (black on white).

WCAG 2 thresholds

ContentAAAAA
Body text4.5:17:1
Large text (≥ 24px, or ≥ 18.66px bold)3:14.5:1
Icons, borders of inputs, focus rings3:1—

Examples

TextBackgroundRatio
#000000#ffffff21.00:1
#767676#ffffff4.54:1
#ffffff#2563eb5.17:1
#ffffff#e11d484.70:1
#ffffff#16a34a3.30:1
#000000#facc1513.71:1
#ffffff#f59e0b2.15:1

#767676 is the lightest gray that passes AA on white.

Frequently asked questions

What contrast ratio do I need?
At least 4.5:1 for normal text and 3:1 for large text to meet WCAG 2 level AA, which most accessibility laws reference.
Does opacity affect contrast?
Yes. Semi-transparent text blends with the background; check the blended color, not the original.
What about APCA / WCAG 3?
APCA is a newer contrast method proposed for WCAG 3. It is still a draft; legal requirements today use the WCAG 2 ratio shown here.