Short answer
WCAG 2.2 requires 4.5:1 contrast for normal text (level AA), 3:1 for large text (18pt+, or 14pt bold) and non-text UI components, and 7:1 for the enhanced AAA level on normal text. These ratios are calculated from the relative luminance of the two colors.

Requirements at a glance

LevelNormal textLarge textUI components
AA (baseline)4.5:13:13:1
AAA (enhanced)7:14.5:1—

Level AA is the baseline legal requirement in most jurisdictions, including the European Union's Web Accessibility Directive and the U.S. Section 508. Level AAA is stricter and is recommended for text that is read extensively.

What counts as "large text"

WCAG defines large text as:

  • 18pt (24 CSS pixels) or larger at any weight.
  • 14pt (18.66 CSS pixels) or larger if the font-weight is 700 (bold) or heavier.

The reasoning: large text is easier to read because the strokes are thicker and the letters occupy more of the visual field. Lower contrast is acceptable because the eye can still resolve the shapes.

In practice: most UI text is not "large." Body text at 16px is normal text — it needs 4.5:1. Headings at 24px or larger qualify as large. Button labels at 14px bold also qualify. When in doubt, treat it as normal text.

How contrast ratio is calculated

The WCAG contrast formula is:

Contrast = (L_lighter + 0.05) ÷ (L_darker + 0.05)

Where L is the relative luminance:

L = 0.2126 × R_linear + 0.7152 × G_linear + 0.0722 × B_linear

And R_linear, G_linear, B_linear are the sRGB channels
after gamma decoding:

  C_linear = C / 12.92                     if C ≤ 0.04045
  C_linear = ((C + 0.055) / 1.055) ^ 2.4   if C > 0.04045

Two important consequences of this formula:

  • Green contributes more to luminance than red, which contributes more than blue. This is why dark blue on white has higher contrast than dark red on white, even at similar lightness.
  • The gamma decoding is important. Contrast is not computed on the raw hex values but on linearized RGB — which is how the eye actually perceives brightness.

You rarely need to compute this by hand. Use the contrast checker — it applies the exact WCAG formula.

What the thresholds mean in practice

4.5:1 (AA normal text)

The baseline for body copy, form labels, error messages and any text a user needs to read.

A 4.6:1 pairing: #6B7280 on #FFFFFF

7:1 (AAA normal text)

Enhanced contrast for reading-intensive content: documentation, articles, forms in difficult environments.

A 10.3:1 pairing: #374151 on #FFFFFF

3:1 (AA large text and UI)

Large headlines, button labels at 18pt+, icons, borders, focus rings.

A 2.9:1 pairing: #9CA3AF on #FFFFFF

Under 3:1

Fails all levels for text. Acceptable only for decorative elements that do not carry meaning.

A 1.6:1 pairing: #D1D5DB on #FFFFFF

Where WCAG contrast applies

ElementMinimum (AA)Notes
Body text4.5:1The most common use case
Headings at 24px+3:1Counts as large text
Button labels under 18.66px bold4.5:1Counts as normal text
Button labels at 18.66px bold or 24px+3:1Counts as large text
Form field borders3:1Non-text UI component
Icons that carry meaning3:1Non-text UI component
Focus rings3:1Non-text UI component
Disabled elementsExemptInactive components are exempt
Decorative graphicsExemptIf they convey no information
Logotypes and brand marksExemptLogos are always exempt

Common pitfalls

Placeholder text

Placeholder text is often styled with light gray "for aesthetics" — but it usually fails contrast. It carries information (what to enter in the field), so it must meet the same 4.5:1 threshold as other text. In practice, many designers use a slightly darker gray, or replace placeholders with persistent labels.

Text on images

If text is placed over a photograph, the "background color" varies pixel by pixel. WCAG requires that contrast holds across the whole image. Solutions:

  • Darken or lighten the image behind the text.
  • Add a semi-transparent overlay.
  • Add a solid backdrop or text shadow (though text shadows are not formally approved).
  • Place the text outside the image entirely.

Alpha colors

Semi-transparent colors must be evaluated against the blended result, not the raw color value. If your text uses rgba(0, 0, 0, 0.5) on white, the effective color is a mid-gray — and it may fail. Test the blended result.

Dark mode

Contrast requirements do not change in dark mode, but the failure modes do. Very high contrast (pure white on pure black) can cause halation for some users, so many designers slightly soften the extremes: #E5E7EB text on a #111827 surface, for example.

APCA — an emerging alternative

APCA (Advanced Perceptual Contrast Algorithm) is a newer contrast model that produces different results than WCAG. It accounts for font weight, polarity (dark-on-light vs light-on-dark) and includes a broader range of values than WCAG's 1:1 to 21:1 scale. It is a candidate for WCAG 3, but is not yet a formal standard.

For now, WCAG 2.2 remains the requirement. Our contrast checker reports both WCAG and APCA results so you can compare them.

Testing checklist

  • Every text/background pair passes 4.5:1 or 3:1 depending on size.
  • Placeholder text passes the same threshold as body text.
  • Focus rings are at least 3:1 against the adjacent background.
  • Icon-only buttons have 3:1 contrast for the icon.
  • Text over images has been tested against the lightest and darkest parts of the image.
  • Alpha colors have been tested against the blended result.
  • Both light and dark themes have been tested independently.

Related resources

Frequently asked questions

What is the WCAG contrast ratio requirement?

WCAG 2.2 requires at least 4.5:1 contrast for normal text (level AA), 3:1 for large text and UI components, and 7:1 for the enhanced AAA level on normal text. These thresholds apply to any text that a user needs to read.

What counts as large text in WCAG?

WCAG defines large text as 18pt (24 CSS pixels) or larger, or 14pt (18.66 CSS pixels) or larger if the text is bold (700 weight or heavier). Large text is easier to read at lower contrast, so the requirement is lower (3:1 instead of 4.5:1).

How is contrast ratio calculated?

Contrast ratio is (L₁ + 0.05) ÷ (L₂ + 0.05), where L₁ and L₂ are the relative luminances of the lighter and darker colors. Relative luminance is computed from linearized sRGB values weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue.

Does WCAG contrast apply to images?

Yes, if the image contains text that conveys information. Decorative images do not need to meet contrast. For text over images, test the lightest and darkest parts of the background to ensure contrast holds across the range.

Is a 3:1 ratio ever enough?

Yes, for two cases: large text (18pt+ or 14pt bold) and non-text UI components such as icons, borders, charts and graphical elements. For normal body text, 4.5:1 is the minimum at level AA.