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

PublishedToolColor Contrast Checker with Fix Suggestions

Contents
  1. Why You Can't Judge Contrast by Feel
  2. The Actual Formula: Start With Relative Luminance
  3. AA, AAA, and Why Large Text Has a Different Bar
  4. Common Traps People Miss
  5. The Bottom Line
  6. Frequently Asked Questions

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.

Color Contrast Checker with Fix Suggestions

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.

CategoryAA (minimum)AAA (enhanced)
Normal text4.5:17:1
Large text3:14.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.

SituationWhat's easy to miss
Text over a background imageThe 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 backgroundsIf 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 statesIt'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.
Color Contrast Checker with Fix Suggestions

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

Related articles

  1. RGB color distance formula: check your color match accuracyLearn how RGB Euclidean distance turns color differences into a 0–100 match score, then practice with a free slider game.
  2. Color Palette Generator: Why Random Colors Still HarmonizeSee how a palette generator picks 5 random colors that still harmonize, using hue angles plus fixed saturation and lightness ranges you can check by hand.
  3. What Is a Complementary Color? 180° Rule and HSL AnglesA complementary color sits exactly 180° away on the color wheel. See how analogous, triadic, and tetradic schemes split the hue circle, plus the HSL math.
  4. CSS Keyframes Animation Timeline Formula and 60fps GuideLearn how CSS keyframe animations interpolate values, writing fade and pulse effects, and keeping motion at 60fps with transform and opacity.
  5. CSS Blob Shapes: 8-Value border-radius Formula GuideLearn how to build organic blob shapes in CSS with the eight-value border-radius formula, plus a hover animation that morphs the shape smoothly.
  6. box-shadow syntax: value order, inset meaning, stacked shadowsLearn what box-shadow values do — offset-x, offset-y, blur, spread, color — how inset flips the shadow inward, and how comma-stacked shadows add depth.

Related tools