Color contrast checker (WCAG)

Pick a text color and a background color to see the contrast ratio, the AA/AAA result and a suggested fix when the pair fails.

Large sample text

This is sample body text so you can judge readability with these colors.

Contrast ratio

—

  • AA normal text (4.5:1)
  • AA large text (3:1)
  • AAA normal text (7:1)
  • AAA large text (4.5:1)
  • UI components (3:1)

Accessible text color suggestions

  • For AA (4.5:1) —
  • For AAA (7:1) —

Why text and background contrast matters

Contrast is the difference in luminance between two colors. When it is too small, text blends into the background and reading takes effort, or does not happen at all. That affects far more people than you might expect:

That is why accessibility guidelines measure luminance rather than hue: it is the best predictor of whether text will be readable for the largest number of people.

The WCAG 2.2 contrast criteria

WCAG (Web Content Accessibility Guidelines), published by the W3C, has three success criteria related to color contrast. Version 2.2 keeps the same thresholds as 2.0 and 2.1:

Badge in the toolCriterionMinimum ratio
AA normal text1.4.34.5:1
AA large text1.4.33:1
AAA normal text1.4.67:1
AAA large text1.4.64.5:1
UI components1.4.113:1

Thresholds are not rounded: a pair at 4.49:1 fails AA for normal text. The standard does include exceptions, such as logos, purely decorative text and disabled components. The full wording is in the official W3C documentation.

What counts as large text

For WCAG, large text is at least 18 points (about 24 px) at regular weight, or 14 points (about 18.66 px) in bold. Bigger, heavier letters have wider strokes, so they stay readable with less contrast.

In practice, headings usually qualify as large text; body copy, captions, form labels and inline links do not. Very thin typefaces or unusual letterforms may need more than the minimum contrast, even at large sizes.

How the contrast ratio is calculated

The calculation has two steps. First, each color is converted to relative luminance, a value from 0 (black) to 1 (white). Each RGB channel is divided by 255 and linearized, undoing the sRGB gamma curve:

c = value / 255
if c ≤ 0.04045: c = c / 12.92
else:           c = ((c + 0.055) / 1.055) ^ 2.4

L = 0.2126 × R + 0.7152 × G + 0.0722 × B

The weights reflect how the eye works: we perceive green as much brighter than blue. Then the ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color.

Example with #FF5733: the linearized channels are R = 1, G ≈ 0.0953 and B ≈ 0.0331, which gives L ≈ 0.283. On white (L = 1), the ratio is 1.05 / 0.333 ≈ 3.15:1: it passes for large text and UI components but fails for normal text. On black (L = 0), the ratio is 0.333 / 0.05 ≈ 6.66:1, enough for AA at any size.

Common contrast mistakes

Light gray on white

This is the most frequent issue on “minimal” websites. #999999 on white is only 2.85:1. The lightest gray that still passes AA for normal text on white is #767676 (4.54:1); #777777 lands at 4.48:1 and fails. For AAA you need to go down to #595959 (7:1).

Text over images

A photo has light and dark areas, and contrast has to work in the worst one. Use the image color picker to sample the lightest pixel behind white text and test it here. If it fails, add a semi-transparent dark overlay on the image or place the text on a solid background.

Placeholder and helper text

Placeholder text inside inputs is often a very light gray. If it conveys information, such as the expected date format, the same 4.5:1 applies. Better still, never use a placeholder as the field's only label.

Focus states, hover and borders

Focus outlines and input borders are visual components and need 3:1 against adjacent colors under criterion 1.4.11. WCAG 2.2 also added criterion 2.4.13 (Focus Appearance, AAA), which covers the size and contrast of the focus indicator. A hover state that only nudges the shade slightly also goes unnoticed by many users.

How to fix a failing color pair

In most cases the fix is to change lightness while keeping the hue: darken the text on light backgrounds or lighten it on dark ones. That way the color stays recognizable as part of your brand. This is exactly what the tool's suggestion does: it finds the text color closest to the original, with the same hue, that reaches AA or AAA, and one button applies it instantly.

  1. Enter the text and background colors (the swap button helps you test the reverse pairing, as in dark mode).
  2. Check the badges and the live preview.
  3. If a level fails, apply the suggestion and make sure the result still fits the rest of your palette.
  4. Copy the page link: it stores both colors, so you can send it to your team for review.

Enough contrast does not solve everything. Avoid conveying information through color alone, such as errors in red and success in green with no icon or text. The color blindness simulator shows how your palette looks to others, and our guides on contrast and accessibility and designing for color blindness include practical examples.

Frequently asked questions

What is the minimum contrast recommended by WCAG?

For level AA, normal text needs at least 4.5:1 and large text (24 px and up, or 18.66 px bold) needs 3:1. For level AAA the minimums rise to 7:1 and 4.5:1.

How is the contrast ratio calculated?

From the relative luminance of both colors: (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color. The result ranges from 1:1 (same color) to 21:1 (black on white).

Does contrast also apply to icons and buttons?

Yes. WCAG 2.1 requires 3:1 for user interface components and graphics needed to understand content, such as input borders and icons.

What should I do when a pair fails?

Darken or lighten one of the colors. The tool automatically suggests the closest color to the original that reaches the selected level while keeping the same hue.