WCAG contrast ratio calculator from HEX colors — how do I check text vs background for AA and AAA accessibility?

Use relative luminance in sRGB, then contrast = (Llighter + 0.05) / (Ldarker + 0.05). Our Color Picker shows ratio and badges: Fail, AA Large, AA, AAA. Pick the text color, set a comparison swatch (preset or custom HEX), and read the ratio instantly.

Detailed answer

WCAG 2.1 uses the same luminance definition for normal text (AA 4.5:1, AAA 7:1) and large text (AA 3:1). Eyedropper support lets you sample UI pixels. For strict audits, verify with official docs; this tool is ideal for quick design iteration.

Relationship context

Accessibility is about perceptual contrast on real devices; calculators assume sRGB-encoded values as entered.

Example sRGB codes (HEX · RGB · HSL)

HEXRGBHSL (rounded)
#3498DBrgb(52, 152, 219)hsl(204, 70%, 53%)
#E74C3Crgb(231, 76, 60)hsl(6, 78%, 57%)
#2ECC71rgb(46, 204, 113)hsl(145, 63%, 49%)
#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)

Illustrative sRGB examples; HSL matches integer rounding in the Color Picker UI.

More Color Picker tools

Open the main picker or a fixed input/output converter—same math as the hub, with copy-ready strings.