Color Contrast Checker

Validate color combinations for WCAG accessibility compliance. Check contrast ratios for normal and large text to ensure your designs are accessible to all users.

How the Color Contrast Checker works

Enter a text color and a background color to get their WCAG 2 contrast ratio and AA and AAA results. Pick your font size and weight to see which result applies to your text, with a live preview.

  1. Set Foreground Color (Text) and Background Color with the color pickers or 3- or 6-digit hex codes.
  2. Choose your text's Font Size and Font Weight. Together they decide whether it counts as normal or large text under WCAG.
  3. Read the contrast ratio and the verdict for your text. Results update as you change any setting.
  4. Compare the Normal Text and Large Text cards; the one that applies to your text is outlined.
  5. Click Copy Results or Download for a text report.

The formula

Each channel of each color is divided by 255 and converted to linear light: values at or below 0.03928 are divided by 12.92, and others become ((value + 0.055) / 1.055) raised to the power 2.4. Relative luminance is L = 0.2126 × R + 0.7152 × G + 0.0722 × B.

The contrast ratio is (L of the lighter color + 0.05) ÷ (L of the darker color + 0.05). It ranges from 1:1 for identical colors to 21:1 for black on white, and it does not matter which color is the text.

Worked example

Gray #767676 on white: each channel is 118 / 255 = 0.4627, which converts to 0.1812, so L = 0.1812. White has L = 1. The ratio is 1.05 ÷ 0.2312 = 4.54:1, which passes AA for normal text and AAA for large text but fails AAA for normal text.

One step lighter, #777777 on white is 4.478:1, displayed as 4.47:1, and fails AA for normal text. Ratios are compared without rounding and displayed rounded down, so a failing ratio never appears as 4.50:1.

Thresholds and large text

WCAG 2 requires 4.5:1 for normal text and 3:1 for large text at level AA, and 7:1 and 4.5:1 at level AAA. Large text is at least 18 point (24px) at any weight, or at least 14 point (about 18.66px) when bold.

So 16px text is normal text even when bold, 20px text counts as large only when bold, and 24px text is always large. The Font Size menu shows both pixels and points, and the verdict line names which category applies.

Limits and privacy

Colors must be 3- or 6-digit hex codes; an invalid code shows a message under the field until it is fixed. Transparency is not supported. The check runs entirely in your browser.

Frequently asked questions

What contrast ratio do I need to pass WCAG AA?

At least 4.5:1 for normal body text and 3:1 for large text. AAA raises those to 7:1 and 4.5:1. The ratio must meet the threshold exactly, with no rounding up.

What counts as large text under WCAG?

Text at least 18 point (24 CSS pixels) at any weight, or at least 14 point (about 18.66 CSS pixels) when bold. Most body text at 16px is normal text, even when bold.

Is AAA contrast required?

Usually not. Most accessibility policies and laws point to WCAG level AA. AAA is a stricter target that WCAG itself says is not achievable for all content, but it is worth meeting for long passages of body text when you can.

What does a contrast ratio of 21:1 mean?

It is the maximum possible, black on white. The scale runs from 1:1, where both colors have the same luminance and text is invisible, up to 21:1.

Does passing the contrast check make colors safe for color-blind users?

It helps, because the ratio is based on brightness, which most color-blind people perceive. But it cannot tell whether two hues are distinguishable, so do not rely on color alone to convey meaning, such as red and green status labels.

Can I use this for icons and buttons?

Yes, as a guide. WCAG asks for 3:1 between interface components or meaningful graphics and their surroundings, which is the same number as the AA threshold on the Large Text card.

Similar Developer tools

3 related