How the WCAG Contrast Ratio Is Calculated
Contrast ratio compares how bright two colors appear to the eye. Each color is first converted to its relative luminance - a single brightness value that weighs the red, green, and blue channels unevenly, since the human eye perceives green as brighter than red, and red as brighter than blue, for the same intensity.
Once both colors have a luminance value, the ratio is simply the lighter luminance plus a small constant, divided by the darker luminance plus the same constant. The result always falls between 1:1 (identical colors, no contrast at all) and 21:1 (pure black against pure white, the maximum possible contrast).
AA vs AAA Standards
| Level | Normal Text | Large Text |
|---|---|---|
| WCAG AA | 4.5:1 minimum | 3:1 minimum |
| WCAG AAA | 7:1 minimum | 4.5:1 minimum |
"Large text" is defined as 18pt (24px) regular weight or larger, or 14pt (18.66px) bold or larger - bigger, bolder shapes stay legible at lower contrast, so the bar is lower. AA is the widely-referenced baseline most sites and many regional accessibility laws target; AAA is a stricter, optional standard that's genuinely harder to hit with vibrant brand colors and is typically reserved for content aimed specifically at users with low vision.
Why Color Contrast Matters
Tips for Picking Accessible Color Pairs
Frequently Asked Questions
Large text is defined as 18pt (24px) regular weight or larger, or 14pt (18.66px) bold or larger. Large text gets a lower minimum contrast ratio because bigger, bolder shapes remain legible at lower contrast than small body copy.
Each color's relative luminance (its perceived brightness, accounting for how the eye weights red, green, and blue differently) is calculated, then the lighter luminance plus 0.05 is divided by the darker luminance plus 0.05 to produce a ratio between 1:1 and 21:1.
Not entirely. The WCAG ratio measures brightness difference (luminance), not hue difference, so it's a solid proxy for general readability but was never designed to guarantee two colors are distinguishable for every type of color blindness. Treat a high contrast ratio as a good foundation, and avoid using color alone to convey meaning - pair it with text labels, icons, or patterns too.
Larger, bolder character strokes cover more area and their edges are easier for the eye to resolve, so they stay legible at lower contrast than small body text does. That's why WCAG sets the bar lower for large text (3:1 at AA, 4.5:1 at AAA) than for normal text (4.5:1 at AA, 7:1 at AAA) - size does some of the work contrast would otherwise have to do alone.
It's still the official standard AA/AAA compliance is measured against today, but it's a simplified model - it can overrate contrast for some very light or very dark color pairs and underrate it for certain mid-tones. A newer perceptual model called APCA is being explored for a future WCAG 3, but until that work is finalized, the WCAG 2.x ratio this tool calculates remains the number that matters for compliance.