How the contrast checker works
The formula
Contrast = (L1 + 0.05) Γ· (L2 + 0.05), where L is relative luminance: sRGB channels linearized, then perceptually weighted (0.2126 R + 0.7152 G + 0.0722 B β the green bias matches human vision). The ratio runs 1:1 (identical colors) to 21:1 (black on white).
The verdicts
- 4.5:1 β WCAG AA for normal text (the legal standard most sites target).
- 3:1 β AA for large text (18pt+/24px, or 14pt bold) and UI components (buttons, borders, icons).
- 7:1 β AAA for normal text; the enhanced standard.
Fixing failures
- Move luminance, not hue. Gray-blue on gray-blue fails at any hue; darken one side until the ratio crosses 4.5.
- Watch the green channel: luminance is 71% green β greens and reds with the same lightness fail against each other constantly (and vanish for color-blind users).
- Check states: buttons have hover, disabled, and focus variants β each pairing needs its own pass.