What is a contrast ratio?

The contrast ratio compares how light two colors are. It runs from 1:1 for two identical colors to 21:1 for black on white. The Web Content Accessibility Guidelines (WCAG) use it to check that text stays readable, including for people with low vision.

WCAG 2 has two levels. AA needs at least 4.5:1 for normal text and 3:1 for large text. AAA needs 7:1 for normal text and 4.5:1 for large text. Large text means at least 18 point (24 pixels), or 14 point (about 18.7 pixels) in bold.

Tool description

Pick a Text color and a Background color, and the Accessibility Color Checker shows their Contrast Ratio and the WCAG level they reach. It starts on black text on white. Type a hex code or an RGB or HSL color into a field, or click its color square to pick one.

Normal Text (WCAG) and Large Text (WCAG) show the highest level the colors pass: AAA, AA or Fail. The Recommendation sums up which text sizes they work for, and the Preview shows sample text in both colors.

Features

  • The WCAG 2 contrast ratio of a text color and a background color
  • AA and AAA results for normal and large text
  • A preview of normal and bold text in your colors

Examples

Text color Background Contrast Ratio Normal text Large text
#000000 #ffffff 21.00 AAA AAA
#767676 #ffffff 4.54 AA AAA
#777777 #ffffff 4.48 Fail AA
#ffc107 #ffffff 1.63 Fail Fail

#767676 is the lightest gray that passes AA for normal text on white.

Good to know

  • The ratio is shown with two decimals, but the levels use the exact value. #959595 on white shows 3.00 and still fails for large text, because it's just under 3.
  • Icons and the borders of buttons and form fields need 3:1 against the colors next to them, the same as large text. WCAG has a separate rule for them.