Color Contrast Checker
Check WCAG 2.1 color contrast ratio between text and background colors. Verify AA and AAA compliance for accessible web design.
About
Incorrect color contrast is the single most common accessibility violation on the web. The Web Content Accessibility Guidelines (WCAG 2.1) define precise thresholds: a contrast ratio of at least 4.5:1 for normal text (Level AA) and 7:1 for enhanced readability (Level AAA). Failing these thresholds means your content is illegible to roughly 300 million people with color vision deficiencies. This tool computes the relative luminance L of both your foreground and background colors using the sRGB linearization model specified in WCAG 2.1 ยง1.4.3, then derives the contrast ratio CR. It does not approximate. It uses the exact gamma-corrected formula mandated by the standard.
Note: this tool assumes opaque colors. If your foreground uses alpha transparency, the effective contrast depends on the composite result against the actual background, which varies by rendering context. Pro Tip: large text is defined as 18pt regular or 14pt bold. Misidentifying your text size leads to false compliance.
Formulas
The contrast ratio between two colors is derived from their relative luminance values. First, each sRGB channel is linearized:
where CsRGB is the channel value divided by 255. Relative luminance is then:
The contrast ratio between two luminances L1 (lighter) and L2 (darker) is:
Where L1 โฅ L2. The result ranges from 1:1 (identical colors) to 21:1 (black on white). Rlin, Glin, Blin are the linearized red, green, and blue channel values respectively. CR is the contrast ratio. The coefficients 0.2126, 0.7152, 0.0722 reflect human photopic sensitivity per ITU-R BT.709.
Reference Data
| WCAG Level | Text Size | Min. Contrast Ratio | Use Case |
|---|---|---|---|
| AA | Normal (< 18pt) | 4.5:1 | Body text, labels, form fields |
| AA | Large (โฅ 18pt or 14pt bold) | 3:1 | Headings, large UI elements |
| AAA | Normal (< 18pt) | 7:1 | Long-form reading, legal text |
| AAA | Large (โฅ 18pt or 14pt bold) | 4.5:1 | Critical navigation, alerts |
| AA | UI Components & Graphics | 3:1 | Icons, borders, focus indicators |
| Non-text | Incidental / Decorative | No requirement | Disabled controls, logos |
| Reference | Black on White | 21:1 | Maximum possible contrast |
| Reference | White on White | 1:1 | Minimum possible (invisible) |
| Common Fail | Light gray (#999) on white | 2.85:1 | Placeholder text (fails AA) |
| Common Fail | Red (#FF0000) on black | 5.25:1 | Error states (passes AA) |
| Common Fail | Yellow (#FFFF00) on white | 1.07:1 | Highlight text (fails all) |
| Guideline | WCAG 2.1 ยง1.4.3 | Level AA | Minimum conformance for text |
| Guideline | WCAG 2.1 ยง1.4.6 | Level AAA | Enhanced conformance for text |
| Guideline | WCAG 2.1 ยง1.4.11 | Level AA | Non-text contrast (UI, graphics) |
| Standard | Section 508 (US) | Maps to WCAG AA | US federal accessibility law |
| Standard | EN 301 549 (EU) | Maps to WCAG AA | European accessibility standard |