Color

Color contrast: the WCAG math and what it doesn't tell you

How WCAG 2.x contrast is calculated, why the algorithm is imperfect, and how to design accessible color systems anyway.

By A11y Lens Team · Updated 2026-07-08 · 10 min read

The formula

WCAG contrast is (L1 + 0.05) / (L2 + 0.05), where L1 and L2 are the relative luminances of the two colors. Relative luminance is a weighted sum of sRGB channels after linearization.

Thresholds

  • 1.4.3 AA: 4.5:1 for body text, 3:1 for large text (≥18pt or ≥14pt bold).
  • 1.4.6 AAA: 7:1 body, 4.5:1 large.
  • 1.4.11 AA: 3:1 for interactive UI components and meaningful graphics.

Known limitations

WCAG 2 contrast underweights blue and mid-tone contrast. APCA (the algorithm proposed for WCAG 3) is closer to perceptual reality but is not yet normative. Design for WCAG 2 today, keep an eye on APCA for the future.

Practical rules for design systems

  1. Define a text scale with pre-checked pairings: text-primary on bg-canvas, text-muted on bg-card.
  2. Never place body text on gradients or images without a solid backdrop.
  3. For focus rings, aim for 3:1 against both the component and the adjacent background.
  4. Test with CVD simulators (protanopia, deuteranopia, tritanopia). Never rely on color alone to convey state — pair it with an icon or label.

Alpha and blending

Semi-transparent text (rgba(0,0,0,0.6)) must be composited over its actual background before measuring. Our Contrast Checker does this automatically.

We use essential browser storage to remember your preferences. If advertising or analytics is enabled, you can choose whether to allow those non-essential technologies. Read our Cookie Policy and Privacy Policy.