How to check contrast
- 1Enter the text color and background color as HEX, RGB, HSL or a CSS name — or use the color swatches.
- 2Read the contrast ratio and the pass/fail results for normal text, large text and UI components.
- 3Check the live preview with real text sizes.
- 4If a check fails, apply one of the suggestions: the closest text or background color (same hue) that passes AA or AAA.
WCAG contrast requirements
Large text means at least 18 point (24 CSS px) regular or 14 point (about 18.66 CSS px) bold.
| Success criterion | Level | Minimum ratio |
|---|---|---|
| 1.4.3 Contrast (Minimum) — normal text | AA | 4.5:1 |
| 1.4.3 Contrast (Minimum) — large text | AA | 3:1 |
| 1.4.6 Contrast (Enhanced) — normal text | AAA | 7:1 |
| 1.4.6 Contrast (Enhanced) — large text | AAA | 4.5:1 |
| 1.4.11 Non-text Contrast — icons, borders, focus rings | AA | 3:1 |
How the ratio is calculated
Each color is converted to linear light (removing the sRGB gamma curve) and its relative luminance is computed as 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. Results range from 1:1 (identical colors) to 21:1 (black on white).
WCAG specifies that ratios must not be rounded up, so a ratio of 4.499 does not pass 4.5:1. This checker truncates the displayed value and evaluates the exact number.
If your text color is semi-transparent, it is blended over the background first, as the browser would render it.
Frequently asked questions
What contrast ratio do I need for WCAG AA?
4.5:1 for normal body text and 3:1 for large text (24px, or 18.66px bold) and for meaningful UI elements such as icons and input borders.
Is WCAG 2.2 different from 2.1 for contrast?
No. WCAG 2.2 keeps the same contrast criteria (1.4.3, 1.4.6 and 1.4.11) as WCAG 2.1. It adds other criteria, such as focus appearance and target size.
How are the suggested colors chosen?
The checker keeps the hue and saturation of your color and changes only the lightness, by the smallest amount needed to reach the target ratio. If no lightness value can reach it, it tells you so.
Does passing contrast guarantee accessibility?
Contrast is one important part. Also consider font size and weight, not relying on color alone to convey meaning, and how your design looks to people with color vision deficiencies.