WCAG Contrast Ratio 4.5:1: Where the Numbers Come From

Contents
You've probably seen a color combination in a design mockup that "looks sharp" but fails in a web accessibility checker. That happens because contrast ratio isn't a judgment call your eyes make — it's an exact number produced by a fixed formula.
Summary ① Contrast ratio is an exact number calculated from the relative luminance of colors. It isn't a sensory judgment you make by eye. ② WCAG sets different bars for normal text at 4.5:1 (AA) and large text at 3:1 (AA). ③ Some combinations look crisp to the eye but fall short on paper, and the reverse happens too.
Why You Can't Judge Contrast by Feel
The same color pair can look "easy to read" or "impossible to read" depending on your monitor brightness, the lighting around you, and your own eyesight. For people with low vision or color vision deficiency, a combination that looks clear by typical standards can still be hard to tell apart.
To guarantee a minimum level of readability for everyone, across all those personal and environmental differences, you need an objective standard you can calculate rather than a sense of what looks right. That's why WCAG (Web Content Accessibility Guidelines) defines contrast ratio as a number.
The Actual Formula: Start With Relative Luminance
Calculating a contrast ratio takes two steps. First you find the relative luminance of each color, then you use those two luminance values to compute the ratio.
Relative luminance isn't just the RGB channel values added together. It reflects the fact that human eyes are more sensitive to some wavelengths than others — red, green, and blue are all perceived with different sensitivity. So each channel is multiplied by a different weight and then summed. The green channel gets the largest weight and the blue channel the smallest. Before that, each channel value goes through a process called gamma correction to make it linear.
Once you have the relative luminance of both colors, you divide the lighter one (the numerator) by the darker one (the denominator), adding 0.05 to each. That gives you the contrast ratio. Two identical colors come out to 1:1, and pure black against white gives the maximum, 21:1.
Doing this by hand means converting the RGB values to a 0 to 1 range, applying the gamma correction formula separately to each channel, then multiplying by the weights and summing — for every single color. If you want to compare several combinations, you repeat the whole thing that many times, which makes it practically impossible without a calculator.
Enter just the HEX codes for your text and background color and the contrast ratio is calculated instantly. If the pair falls short, you also get alternative colors that pass.

AA, AAA, and Why Large Text Has a Different Bar
WCAG's contrast requirements aren't a single number. They split by text size and conformance level.
| Category | AA (minimum) | AAA (enhanced) |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text | 3:1 | 4.5:1 |
The definition of "large text" here isn't arbitrary — WCAG spells out specific criteria. Text that is at least 18 point, or at least 14 point when bold, falls into this category.
Bigger letters make the shape of each stroke easier to distinguish, so even a relatively low contrast ratio doesn't get in the way of reading. That's why WCAG allows a lower numeric threshold for large text. Small text is the opposite: the strokes themselves are thinner, so the same contrast ratio makes letters blur together more easily.
Common Traps People Miss
The math itself is precise, but there are spots people often overlook when applying it to a real screen.
| Situation | What's easy to miss |
|---|---|
| Text over a background image | The calculation assumes a solid background, so it doesn't carry over directly to something like a photo where brightness varies from spot to spot |
| Gradient backgrounds | If the start and end colors have different contrast ratios, you have to judge by the point where the text sits and contrast is lowest |
| Hover and focus states | It's easy to check only the default state colors and skip right past the color combinations that appear when the state changes |
In these cases, don't judge by one representative value. Recalculate based on the least favorable spot where text actually overlaps.
The Bottom Line
- Contrast ratio is an exact number calculated with the relative luminance formula, not a matter of feel.
- Normal text needs AA 4.5:1 and AAA 7:1. Large text (18pt or larger, or bold at 14pt or larger) needs AA 3:1 and AAA 4.5:1.
- The large text bar is lower because bigger letters are easier to tell apart, so a lower contrast ratio causes less trouble reading.
- Background images, gradients, and hover states aren't uniform color situations. Check them separately against the lowest-contrast point.
Enter just the HEX codes for your text and background color and the contrast ratio is calculated instantly. If the pair falls short, you also get alternative colors that pass.
Frequently Asked Questions
What contrast ratio do I need to pass?
Normal-sized text needs to be at least 4.5:1 (the AA bar). Under the stricter AAA bar, you need 7:1. Large text — 18 point or larger, or bold at 14 point or larger — gets a relaxed requirement of 3:1 for AA and 4.5:1 for AAA.
Exactly what size counts as large text?
WCAG defines large text as text that is at least 18 point, or at least 14 point when bold styling is applied. So the cutoff is 18 point at normal weight, and 14 point if it's bold.
Why does the contrast checker result feel different from what I see on screen?
The calculation only looks at the relative luminance ratio of two solid colors. On a real screen, factors that the math doesn't account for — monitor brightness settings, ambient lighting, and backgrounds that are images or gradients instead of solid colors — affect how readable things actually feel. If the background isn't uniform, check the lowest-contrast point separately.
Should I aim for AA or AAA?
In WCAG 2.1, AA is treated as the general minimum for web accessibility, and AAA is a stricter enhanced level above it. Which one applies depends on your situation and target level, so use AA (4.5:1 for normal text, 3:1 for large text) as your baseline, and check the AAA numbers if you need a higher level of accessibility.
This article was adapted from our Korean original. Read the Korean original