Color Contrast Checker — WCAG AA & AAA Ratio
Contrast ratio, AA/AAA/UI pass or fail, live preview and nearest passing color suggestions
Runs in your browser · nothing is uploaded
Contrast 4.48:1. AA normal text Fail, AAA normal text Fail, UI components Pass.
Contrast ratio
4.48:1
- AA normal text (4.5:1)Fail
- AA large text (3:1)Pass
- AAA normal text (7:1)Fail
- AAA large text (4.5:1)Fail
- UI components & graphics (3:1)Pass
Body text at 16px — the quick brown fox jumps over the lazy dog.
Large text, 24px bold
Nearest passing color
Keeps hue (H) and saturation (S) and only nudges lightness (L).
- Change the text color to
#767676 (4.54:1, lightness 46.7% → 46.4%) - Change the background to
#060606 (4.52:1, lightness 100% → 2.5%)
Overview
Light gray text can look elegant on a white page and still be nearly invisible to someone with low vision, or to anyone reading a phone in sunlight. Enter a text color and a background color to get the WCAG contrast ratio and a pass or fail for each level. If the pair falls short, the checker finds the closest color that passes while keeping the original hue.
How to use
- Enter the Text color and Background color, or use the color pickers. Any CSS color works:
#777777,rgb(119 119 119),hsl(0 0% 47%)ornavy. - Read the ratio and the results for AA and AAA normal text, large text and UI components.
- Look at the preview to see body text, large text, a button outline and an icon in those colors.
- If a check fails, choose a Target and press Apply on the suggested text or background color. The ⇄ button swaps the two colors.
Criteria
- Relative luminance and the contrast formula follow WCAG 2.x (the same in 2.0, 2.1 and 2.2): sRGB values are linearized and weighted as 0.2126 R + 0.7152 G + 0.0722 B.
- Thresholds: AA normal text 4.5:1, AA large text 3:1, AAA normal text 7:1, AAA large text 4.5:1, UI components and graphics 3:1.
- Translucent colors are composited the way browsers paint them (sRGB alpha blending) before measuring.
- Everything is calculated in your browser; the colors you enter are not sent anywhere.
Examples
| Text | Background | Ratio | Result |
|---|---|---|---|
#000000 |
#ffffff |
21:1 | Passes every level |
#777777 |
#ffffff |
4.48:1 | Fails AA normal text; passes large text and UI |
#767676 |
#ffffff |
4.54:1 | Passes AA normal text (the suggestion for #777777) |
rgba(0,0,0,0.5) |
#ffffff |
about 3.98:1 | Measured as the painted gray; passes AA large text and UI only |
Contrast only measures lightness difference. Do not rely on color alone to convey information; pair it with text or icons.
FAQ
How is the contrast ratio calculated?
Each color's relative luminance is computed with the WCAG 2.x formula, then the ratio is (lighter + 0.05) ÷ (darker + 0.05). Identical colors give 1:1 and black on white gives 21:1. The ratio is shown to two decimals, but pass or fail uses the unrounded value, so 4.499 never shows as 4.5 and passes.
What counts as large text?
WCAG defines large text as at least 18pt (about 24px), or at least 14pt (about 18.66px) in bold. Large text needs 3:1 for AA and 4.5:1 for AAA.
What is the 3:1 UI component check?
It is WCAG 2.1 success criterion 1.4.11, non-text contrast. Input borders, checkboxes, icons and chart lines that people need to see should differ from adjacent colors by at least 3:1.
How are transparent colors handled?
They are measured as the browser paints them. A translucent text color is blended over the background, and a translucent background is first blended over a white page. The painted colors are shown with the result.
How is the suggested color chosen?
Hue and saturation stay the same and only HSL lightness changes, in 0.1% steps. The candidate closest to the original lightness that meets the target wins. Each candidate is rounded to whole RGB values and checked again, so the HEX shown really passes.