Color Contrast Checker for WCAG 2 and APCA

Enter a text color and a background color as 6-digit HEX codes. The tool calculates the WCAG 2 contrast ratio and shows pass or fail for AA and AAA, for normal and large text, next to a preview of the pair. It also shows the APCA lightness contrast (Lc) score.

Aa

The quick brown fox jumps over the lazy dog. Accessibility matters.

Small text sample at 14px - check APCA for minimum font requirements.

WCAG 2 Contrast Ratio

21.00:1
✓
AA Normal
≥ 4.5:1
✓
AA Large
≥ 3:1
✓
AAA Normal
≥ 7:1
✓
AAA Large
≥ 4.5:1

APCA Lightness Contrast

Lc +106.0

Dark text on light background

|Lc| Body text UI / labels
< 45Not suitable36px+ decorative
≥ 4524px regular24px bold
≥ 6016px regular16px
≥ 7514px regular14px
≥ 90Any sizeAny size

Related Developer Tools

Runs in your browser: your files and text are not uploaded. Free, no account needed.

Last updated: · Reviewed by the QuickTooly Team

How the ratio is calculated

The WCAG 2 Contrast Ratio Formula

Each channel is divided by 255 and converted to linear light. Values up to 0.03928 are divided by 12.92. Larger values use ((c + 0.055) / 1.055)^2.4. Relative luminance is L = 0.2126 R + 0.7152 G + 0.0722 B. The ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color. It runs from 1:1 for two identical colors to 21:1 for black on white.

Worked example: #767676 on white

76 in hex is 118, and 118 / 255 = 0.463. Linearized, that is ((0.463 + 0.055) / 1.055)^2.4 ≈ 0.181. All three channels are equal, so the luminance of the gray is 0.181. White has luminance 1. The ratio is (1 + 0.05) / (0.181 + 0.05) = 4.54:1, which passes AA for normal text. One step lighter, #777777, gives 4.48:1 and fails.

What the Four Results Mean

  • AA Normal, 4.5:1: the minimum for body text in WCAG 2 success criterion 1.4.3.
  • AA Large, 3:1: for large text, meaning at least 18 point (24 px), or 14 point (about 18.7 px) bold. WCAG 1.4.11 also asks for 3:1 for interface components and graphics, which this check covers too.
  • AAA Normal, 7:1: the enhanced level in success criterion 1.4.6.
  • AAA Large, 4.5:1: the enhanced level for large text.

Pass and fail use the unrounded ratio, while the display rounds to two decimals. A ratio of 4.499 reads 4.50:1 but still fails AA, because WCAG does not allow rounding up.

About the APCA Panel

APCA is a newer contrast method that is still a draft and not part of WCAG 2, so it does not decide WCAG 2 compliance. The panel uses the apca-w3 library to calculate an Lc (lightness contrast) score. Unlike the WCAG ratio, it depends on which color is the text. A positive Lc means dark text on a light background, a negative Lc means light text on a dark background. Black on white gives about Lc 106, white on black about Lc -108, and #767676 on white about Lc 72. The table under the score is a rough font-size guide based on the absolute value, |Lc|.

Common Mistakes

  • Testing transparent colors. The tool takes opaque 6-digit HEX only. For semi-transparent text, work out the color it produces over its background first, then test that.
  • Testing one spot of an image or gradient. Test the text against both the lightest and the darkest part of the background behind it.

Contrast Checker Questions

Why does my pair pass AA Large but fail AA Normal?

Its ratio is between 3:1 and 4.5:1. That is enough for text of at least 24 px, or about 18.7 px bold, but not for body text. Darken the text or lighten the background until the ratio reaches 4.5:1.

Can I enter a 3-digit HEX code?

No. Only six-digit codes are checked. Until the code is valid, the tool uses #000000 for the text or #ffffff for the background.

Does swapping the colors change the WCAG ratio?

No. The formula always puts the lighter color on top, so text and background can be swapped without changing the ratio or the results. The APCA Lc score does change, because APCA treats dark-on-light and light-on-dark differently.

Fixing a Failing Pair