Robince Studio
Developer Tools

Colour contrast and accessibility: what the WCAG ratios mean

Low-contrast text is one of the most common accessibility problems on the web, and it affects far more people than those with a diagnosed visual impairment: anyone using a phone in sunlight, or reading late at night, benefits from clear contrast. This guide explains the standard thresholds and how to check your colours.

3 min read Reviewed Published by Abdul Gani, Robince Studio

On this page
  1. What contrast ratio measures
  2. The thresholds
  3. Real examples
  4. How to choose accessible colours
  5. Text on images and gradients
  6. Beyond the ratio
  7. Frequently asked questions
  8. Try these tools

What contrast ratio measures

The Web Content Accessibility Guidelines (WCAG) define contrast ratio as a number from 1:1 (no difference, such as white on white) to 21:1 (black on white). It compares the relative luminance, a measure of perceived brightness, of the two colours: (lighter + 0.05) ÷ (darker + 0.05).

Luminance is not the same as simple brightness. It weights green most and blue least, because that is how human eyes respond, and it applies a gamma correction to the colour values. That is why two colours that look equally "bright" on paper can have different contrast.

The thresholds

Large text means roughly 24 pixels, or 18.66 pixels if bold. Graphics that carry meaning, and the borders of input fields and buttons, need at least 3:1 against their surroundings. Pure decoration and disabled controls are exempt.

LevelNormal textLarge text and UI components
AA (the common target)4.5:13:1
AAA (enhanced)7:14.5:1

Real examples

The grey #767676 on white has a contrast of about 4.54:1, so it just passes AA for normal text. The only slightly lighter #777777 has about 4.48:1 and fails. A visible difference of one shade can mean the difference between compliant and non-compliant.

The light grey #999999 on white is only about 2.85:1, which fails for normal text and is too low for most borders. By contrast, a deep blue like #0B57D0 on white scores about 6.39:1 and passes AA comfortably, and black on white scores the maximum 21:1.

Pale grey placeholder text and light-on-light buttons are the usual offenders. Check them first.

How to choose accessible colours

  1. Start with your text and background colours and measure the ratio with a contrast checker.
  2. If a pair fails, darken the text (or lighten the background) slowly until it passes. Small changes in lightness are usually enough, so you can keep your brand hue.
  3. Test every state: hover, focus, disabled, visited links, text over images and error messages.
  4. Do not rely on colour alone to convey meaning. Add an icon, text or pattern, so people who cannot distinguish red from green still get the message.
  5. Check in both light and dark themes, because passing in one does not guarantee the other.

Text on images and gradients

Contrast is hardest when text sits on a photo. Put a semi-transparent dark panel behind the text, apply a gradient overlay, or place text in a plain area of the image. Then measure against the lightest part of the background the text will cross, not the average.

Beyond the ratio

  • Font size and weight matter. Thin light fonts are harder to read at the same ratio.
  • Pure black on pure white can feel harsh for some readers, so many designs use a very dark grey. That is fine as long as the ratio stays high.
  • The WCAG 2 formula has known limits, and newer approaches are being developed, but the 4.5:1 and 3:1 targets remain the standard required by most laws and procurement rules.
  • Always test with real people and real devices when you can.

Frequently asked questions

What contrast ratio do I need?

For WCAG AA, at least 4.5:1 for normal text and 3:1 for large text and interface components. For AAA, 7:1 and 4.5:1.

Does contrast matter for logos and decoration?

Logos and purely decorative elements are exempt from the text-contrast requirements, though clear contrast still helps recognition.

Why is my grey text failing even though it looks fine?

Monitors, brightness and eyes differ. Mid-greys on white often fall just under 4.5:1. Use a checker rather than judging by eye.

How is contrast calculated for transparent colours?

Calculate it after blending the colour with what is behind it. A semi-transparent colour has a different effective colour on each background.

Try these tools

Keep reading