WCAG Contrast Checker

Check whether a text and background color pair meets the WCAG 2.2 contrast requirements, and see the exact ratio.

How to use

What it checks and how it works

Relative luminance is L = 0.2126 R + 0.7152 G + 0.0722 B, where each sRGB channel c from 0 to 1 is made linear: c divided by 12.92 when c is 0.04045 or less, otherwise ((c + 0.055) / 1.055) raised to the power 2.4. The contrast ratio is (L1 + 0.05) divided by (L2 + 0.05), with L1 the luminance of the lighter color. The tool tests five requirements from WCAG 2.2: 4.5:1 for normal text and 3:1 for large text (success criterion 1.4.3, level AA), 7:1 and 4.5:1 (1.4.6, level AAA), and 3:1 for user interface components and graphical objects (1.4.11, level AA). Large text means 18 point, or 14 point bold, or larger. WCAG says computed values should not be rounded, so 4.499:1 does not meet 4.5:1, and the display never rounds a failing ratio up to a threshold. Limits: WCAG does not define contrast for translucent colors, so a translucent text color is blended over the background and a translucent background over white; that is Zaher's convention. The tool compares two flat colors, not text over a photo or a gradient, and it does not apply exceptions such as logotypes or inactive components. WCAG notes that fonts with very thin strokes can need more contrast than the number suggests. The suggested nearby color is Zaher's helper and is not part of WCAG.

What contrast ratio does WCAG AA require?

4.5:1 for normal text and 3:1 for large text under success criterion 1.4.3, and 3:1 for user interface components and graphical objects under 1.4.11.

Why does 4.49:1 fail when it looks like 4.5:1?

WCAG says computed ratios should not be rounded. A ratio of 4.499:1 does not meet 4.5:1, so the tool shows the true result and never rounds a failure up.

Does this check text on images or gradients?

No, it compares two flat colors, so for a photo or gradient test the worst spot behind the text by hand.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.