Overview / Utilities & Calculators / Color Contrast Checker
Utilities & Calculators 100% In-Browser & Offline

Color Contrast Checker

Check the WCAG 2.x contrast ratio of a text color on a background and get a nearest passing color when AA fails.

Enter values; the result is calculated instantly.

Your files and input never leave your browser – nothing is uploaded.

Accepted formats: #rgb, #rrggbb and rgb(r, g, b). Alpha (transparency) is not supported.

Preview

Normal text: The quick brown fox jumps over the lazy dog.

Large text, 24 px (18 pt)

Large bold text, 18.67 px (14 pt)

WCAG 2.x results

Contrast ratio
4.47:1
WCAG 2.x results
CheckMinimumResult
AA, normal text 4.5:1
AA, large text 3:1
AAA, normal text 7:1
AAA, large text 4.5:1
UI components and graphics 3:1
Notes and limits

The ratio is cut after two decimals, not rounded. A value of 4.496 shows as 4.49:1 and fails 4.5.

Large text means 18 pt (24 px) or larger, or 14 pt (18.67 px) or larger in bold.

Limit: colors with alpha are not supported. Use the final, opaque color.

Gray text on white looks fine on a designer's monitor, and then a user with a dim phone screen cannot read it. A color contrast checker gives you the number that settles the argument. Enter a text color and a background color, and the ratio appears as you type, for example 4.47:1 for the sample pair #777777 on white.

Reading the five pass/fail rows

Each row compares your ratio with one WCAG 2.x minimum. AA normal text needs 4.5, AA large text needs 3, AAA normal text needs 7 and AAA large text needs 4.5. The fifth row, user interface components and graphics, needs 3. Large text means 18 pt (24 px) or larger, or 14 pt (18.67 px) or larger in bold. The preview box shows normal text, large text and large bold text in your colors.

Why 4.496 fails

The tool cuts the ratio after two decimals. It does not round. So 4.496 shows as 4.49:1 and fails the 4.5 line. Rounding would show 4.50 and let a failing pair through. The sample pair shows this: the real value is about 4.478, so you see 4.47 and not 4.48.

Fixing a failing pair in four steps

  1. Type or pick the Text color. The text field and the color picker stay in sync.
  2. Type or pick the Background color. Use #rgb, #rrggbb or rgb(r, g, b). Anything else gets an inline error.
  3. Read the ratio and the rows. If AA normal text fails, a box shows the nearest text color that reaches 4.5:1.
  4. Press Use this color to apply it, or press Swap colors to test light text on a dark background.

How the nearest color is found

The suggestion keeps the hue and the saturation of your text color. It changes only the lightness, in steps of 0.1 percentage points. The tool searches darker and lighter, and shows the closer result. For #777777 on white the answer is close to #767676, the lightest gray that passes on white.

What the checker cannot judge

It compares two opaque colors. Colors with alpha, such as rgba() or an 8-digit hex value, are not accepted. Text over a photo or a gradient has no single background, so check the worst spot yourself. The tool also does not know the font size or weight you really use. The large-text rows only tell you what would apply if the text were large.

What happens to your colors

The math runs in the page. No request is sent, and the tool does not store the colors. You can confirm this in the network panel of your browser developer tools.

Frequently asked questions (FAQ)

WCAG 2.x level AA requires at least 4.5:1 for normal text. Level AAA requires at least 7:1.