Contrast Ratio 4.5:1: WCAG AA vs AAA and How to Calculate It

PublishedToolColor Contrast Checker

Contents
  1. Where does 4.5:1 come from?
  2. How to calculate it without a tool
  3. AA, AAA, and the 3:1 exception for large text
  4. Where people get stuck
  5. The bottom line
  6. Frequently Asked Questions

This post is for you if you've been in a design review where someone said the contrast ratio "doesn't hit 4.5:1," and you weren't sure where that number came from. The short answer: contrast ratio is a ratio you get by plugging the relative luminance of two colors into a fixed formula. 4.5:1 is the minimum for normal text at Level AA in the Web Content Accessibility Guidelines (WCAG).

That's not a value you judge by eye. It comes out of a calculation, so there's no room to argue about pass or fail. And once you know the formula, you can check the math yourself.

Summary ① Contrast ratio = (relative luminance of the lighter color + 0.05) ÷ (relative luminance of the darker color + 0.05). Values range from 1:1 to 21:1. ② AA requires 4.5:1 for normal text and 3:1 for large text. AAA requires 7:1 for normal text and 4.5:1 for large text. ③ "Large text" means 18pt (about 24px) or larger, or bold text at 14pt (about 18.7px) or larger.

Where does 4.5:1 come from?

Contrast ratio is a single number that captures how far apart the text color and background color are. Black text on a white background is the widest possible gap, and its value is exactly 21:1.

If the text and background colors are the same, you get 1:1. Every color combination falls somewhere between 1:1 and 21:1.

WCAG sets minimum thresholds for this value. Success Criterion 1.4.3 (Contrast Minimum, Level AA) requires a minimum of 4.5:1 for normal text. When "4.5:1" comes up in a meeting, it almost always refers to this requirement.

This is where things often go wrong. Contrast ratio looks at brightness difference only. The hues can be completely different—red versus blue, for example—but if the brightness is similar, the ratio comes out low.

How to calculate it without a tool

The formula has two steps. Find the relative luminance of each color, then turn the two luminances into a ratio.

Step 1: Find the relative luminance

First, split a HEX color into its R, G, and B values, and divide each by 255 to get a number between 0 and 1. Then apply the following to each channel.

  • If the value is 0.04045 or less → value ÷ 12.92
  • If it's greater → ((value + 0.055) ÷ 1.055) raised to the 2.4 power

Plug the three results into 0.2126 × R + 0.7152 × G + 0.0722 × B, and you have the relative luminance. The coefficients are different because human eyes are most sensitive to green light and least sensitive to blue.

That's why simply comparing the "RGB average" gives a different answer from the actual standard.

Step 2: Turn it into a ratio

Once you have the relative luminance of both colors, call the lighter one L1 and the darker one L2. The contrast ratio is:

(L1 + 0.05) ÷ (L2 + 0.05)

The 0.05 accounts for ambient light that actually reaches the screen. Plug in black (luminance 0) and white (luminance 1), and you get 1.05 ÷ 0.05 = 21, or 21:1.

Let's walk through gray #767676 on a white background. 118 ÷ 255 = 0.4627. That's greater than 0.04045, so ((0.4627 + 0.055) ÷ 1.055) raised to the 2.4 power = about 0.1811. All three channels have the same value, so the relative luminance is also 0.1811.

White has a relative luminance of 1, so (1 + 0.05) ÷ (0.1811 + 0.05) = about 4.54. That just barely clears 4.5:1 and passes AA for normal text.

Paste the following into your browser's developer console (usually F12) to confirm the same value.

const L = (hex) => {
  const c = [1, 3, 5].map(i => parseInt(hex.slice(i, i + 2), 16) / 255)
    .map(v => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4));
  return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
};
const ratio = (a, b) => (Math.max(L(a), L(b)) + 0.05) / (Math.min(L(a), L(b)) + 0.05);
ratio("#767676", "#ffffff");   // 4.5422...

The catch is that every time you change a color, you have to run this process again and check the result against all four thresholds for AA and AAA.

Check it with our free tool, Color Contrast Checker. Enter a foreground and background color in HEX, and it shows the contrast ratio plus pass/fail results for all four checks—AA and AAA, normal and large text—at once.

Color Contrast Checker

It runs right in your browser with no install or sign-up, and the color values you enter are never sent to a server.

AA, AAA, and the 3:1 exception for large text

The requirements break into four combinations: level (AA or AAA) and text size (normal or large).

LevelNormal textLarge text
AA (Success Criterion 1.4.3)4.5:1 or higher3:1 or higher
AAA (Success Criterion 1.4.6)7:1 or higher4.5:1 or higher

The key point is that large text gets a threshold that's one step lower. Larger letters with thicker strokes are easier to read at the same contrast ratio, so the guideline allows down to 3:1.

Large text is defined as 18pt or larger, or 14pt or larger in bold. In CSS, those are about 24px and about 18.7px, respectively. For CJK fonts such as Korean, use the size that looks equivalent.

The table shows one more thing: AAA for large text (4.5:1) and AA for normal text (4.5:1) are the same number. So the moment your contrast ratio crosses 4.5, both of those results flip at the same time, and the only hurdle left is 7:1 for AAA normal text.

Where people get stuck

A one-step difference really can flip the result. On a white background, #767676 is 4.54:1 and passes AA for normal text, but #777777 is 4.48:1 and fails.

SituationWhat happens
Semi-transparent text (opacity or rgba)You need to calculate using the blended color that actually appears on screen
Text over gradients or imagesCalculate using the color at the worst-case point
Dark modeWhen the background changes, the value changes completely, so check it separately
Logos and brand namesThese are exceptions where the guideline does not require a contrast ratio
Disabled elementsText in disabled UI elements is also exempt

To spell out the exceptions a bit more: the guideline does not require a contrast ratio for disabled elements, purely decorative text, invisible text, or text in an image that also contains other meaningful visual content. Logos and brand names are included here too.

One more thing: the cutoff value in the relative luminance formula changed from 0.03928 to 0.04045 in May 2021. With 8-bit color (0–255), though, no channel value falls between those two numbers, so the result is the same.

The bottom line

  • Contrast ratio is a ratio calculated from the relative luminance of two colors, using (lighter + 0.05) ÷ (darker + 0.05).
  • Values range from 1:1 (the same color) to 21:1 (black and white).
  • AA requires 4.5:1 for normal text and 3:1 for large text. AAA requires 7:1 for normal text and 4.5:1 for large text.
  • Large text means 18pt (about 24px) or larger, or bold text at 14pt (about 18.7px) or larger.
  • Contrast ratio looks only at brightness differences, so colors from different hue families can still come out low if their brightness is similar.
  • For semi-transparent text or text over gradients, calculate using the color that actually appears after blending.
Color Contrast Checker

It runs right in your browser with no install or sign-up, and the color values you enter are never sent to a server.

Frequently Asked Questions

WCAG isn't a law. It's a web accessibility guideline published by the W3C. That said, public-sector procurement and audit criteria in many countries point to it, so in practice "does it pass AA?" often shows up as a checklist item in a review. To know which standard actually applies to you, check the client's requirements or the audit documentation.

The colors are completely different, so why is the contrast ratio so low?

Because the contrast formula looks at brightness (relative luminance) only. A medium-brightness red and a medium-brightness green can be opposite hues yet have similar luminance, which gives you a low ratio. Users with color blindness or low vision run into a similar problem, so the guideline uses brightness difference rather than hue difference as its measure.

Do icons and input field borders need 4.5:1 too?

1.4.3 applies to text and images of text. Non-text elements like icons and borders fall under a separate success criterion (1.4.11 Non-text Contrast), which requires 3:1. So the bar splits in two: 4.5:1 for body text, 3:1 for the visual boundaries of UI components.

Are the colors I enter sent to a server?

No. All contrast calculations in this tool run inside your browser. The color values you enter are never sent to a server or stored. You can paste your company's design system palette in as-is and nothing leaves your machine.

This article was adapted from our Korean original. Read the Korean original

Related articles

  1. Why Design Tools Use HSL Instead of RGBWhy Figma and Photoshop color pickers show HSL sliders, and how to lock hue and change only lightness to build a tone-on-tone palette.
  2. APCA vs WCAG 2 Contrast: Dark Mode Lc Readability GuideSee why the WCAG 2 contrast ratio fails in dark mode, how APCA Lc scores color pairs by font size, and how to check both at once.
  3. Aurora Gradient CSS Background: 2KB Animated Code GuideHow a 4-color aurora gradient background works in pure CSS: radial gradients, blur, and GPU-accelerated 60 FPS rotation, plus copy-ready code.
  4. Aurora Gradient CSS Generator: 60 FPS Animated BackgroundCreate a dreamy pastel aurora gradient background in pure CSS: layered radial gradients, 80px blur, 60 FPS rotation, no reflow. Copy the code in one click.
  5. CSS Tag Badge Generator: Pill Tags with Hover EffectsLearn how to style pastel pill tag badges with CSS hover animations and accessible markup, then copy the HTML, CSS, or Tailwind code with our free tool.
  6. border-radius px vs %: Why 50% Skews Buttons and How to Fix ItSee why border-radius: 50% turns a rectangle into an ellipse, how px and % radii are calculated, and the 9999px formula for a clean pill button.

Related tools