Color Contrast Checker (WCAG)

Check the WCAG 2.x contrast ratio between a text color and a background color. Enter the colors as hex, rgb() or hsl(), or choose them with the color picker, and you instantly see the ratio, Pass/Fail badges for AA and AAA on normal and large text and for UI components (1.4.11), plus a live preview of sample text. Translucent foreground colors are blended over the background before the ratio is calculated, and everything runs in your browser.

How to use

  1. Enter the text color under Foreground (text) as #hex, rgb() or hsl(), or click the color swatch next to the field to pick one.
  2. Enter the Background color the same way; if a value cannot be read, the message Enter a valid color (#hex, rgb(), hsl()). appears under the field.
  3. Read the Contrast ratio and the Pass or Fail badges for AA and AAA (Normal text and Large text) and for UI (Components & graphics), and check the preview of normal, large and bold sample text.
  4. Click Swap colors to exchange foreground and background, or Copy ratio to copy the value, for example 4.48 : 1.

Example

Input

Foreground (text): #777777 · Background: #ffffff
Foreground (text): rgba(0, 0, 0, 0.5) · Background: #ffffff

Output

Contrast ratio 4.48 : 1
AA Normal text: Fail · AA Large text: Pass · AAA Normal text: Fail · AAA Large text: Fail · UI: Pass

Contrast ratio 3.95 : 1 (the foreground is blended to #808080)
AA Normal text: Fail · AA Large text: Pass · AAA Normal text: Fail · AAA Large text: Fail · UI: Pass

Frequently asked questions

What contrast ratio do I need to pass WCAG?

Level AA requires at least 4.5:1 for normal text and 3:1 for large text; level AAA requires 7:1 and 4.5:1. User interface components and meaningful graphics need 3:1 under success criterion 1.4.11. The ratio is compared without rounding, so #777777 on white (4.48:1) fails AA for normal text, while the slightly darker #767676 (4.54:1) passes.

What counts as large text?

WCAG treats text as large from 18 pt (24 px) in regular weight or 14 pt (18.66 px) in bold. For large text the AA threshold drops from 4.5:1 to 3:1 and the AAA threshold from 7:1 to 4.5:1. The preview shows sample text at both sizes.

Which color formats can I enter?

Hex with 3, 4, 6 or 8 digits (with or without #), rgb() or rgba() with channels from 0 to 255, and hsl() or hsla() with the hue in deg, rad or turn. Color names such as red are not recognized. An alpha value on the background is ignored, so the background is always treated as opaque.

How are semi-transparent colors handled?

If the foreground has an alpha value below 1, it is blended over the background before the ratio is calculated, so the result matches the color you actually see. For example, rgba(0, 0, 0, 0.5) on white becomes #808080 and gives 3.95:1.

Related tools