Color contrast checker (WCAG)
Enter a text colour and a background colour to get the WCAG contrast ratio, a pass or fail for each level, and the nearest text colour that passes.
Contrast ratio
| Requirement | Needs | Result |
|---|---|---|
| AA, normal text | 4.5:1 | |
| AA, large text | 3:1 | |
| AA, icons, borders, chart lines | 3:1 | |
| AAA, normal text | 7:1 | |
| AAA, large text | 4.5:1 |
Transparent colours are blended first: the text over the background, the background over white.
The quick brown fox jumps over the lazy dog.
Large text, 24 px
Bold text, 18.7 px
ButtonNearest text colours that pass
Same hue as your text colour, only lighter or darker.
- AA 4.5:1No text colour reaches this on that background.
- AAA 7:1No text colour reaches this on that background.
How to use it
- Type or paste the text colour and the background colour, or open the colour picker beside each.
- Read the ratio and the result for each requirement. The preview shows normal text, large text and a button outline in your colours.
- If a level fails, press Use next to a suggested colour to switch to the nearest one that passes.
The WCAG contrast requirements
Large text means at least 18 point (24 CSS pixels) regular, or 14 point (about 18.7 CSS pixels) bold. Logos, disabled controls and pure decoration have no requirement. Most accessibility laws and procurement rules, such as EN 301 549 in the EU, point to level AA.
| Level | Applies to | Minimum | Success criterion |
|---|---|---|---|
| AA | Normal text | 4.5:1 | 1.4.3 |
| AA | Large text | 3:1 | 1.4.3 |
| AA | Icons, input borders, focus rings, chart lines | 3:1 | 1.4.11 |
| AAA | Normal text | 7:1 | 1.4.6 |
| AAA | Large text | 4.5:1 | 1.4.6 |
How the ratio is calculated
Each colour gets a relative luminance. Its red, green and blue values (0 to 255) are divided by 255 and made linear: values at or below 0.04045 are divided by 12.92, the others become ((v + 0.055) / 1.055)2.4. Then L = 0.2126 R + 0.7152 G + 0.0722 B.
The ratio is (L1 + 0.05) / (L2 + 0.05), with the lighter colour as L1. It runs from 1:1 (the same colour) to 21:1 (black on white). This page cuts the ratio to two decimals instead of rounding it, because WCAG counts 4.499:1 as a fail.
How the suggestions work
The suggested colours keep the hue of your text colour in OKLCH, and as much of its colourfulness as the screen range allows. Only the lightness changes, step by step in both directions, until the ratio passes; the nearer colour is shown. On a mid-grey background no colour reaches 7:1, and the page says so.
Related tools
Questions people ask
What contrast ratio do I need?
For WCAG AA: 4.5:1 for normal text, 3:1 for large text and for interface parts such as icons and input borders. AAA asks for 7:1 and 4.5:1.
Does 4.49:1 pass AA?
No. A ratio below the minimum fails even by a little, which is why this page never rounds up.
Can I check a semi-transparent colour?
Yes. Enter it with transparency, for example rgba(0, 0, 0, 0.6). The text is blended over the background before the ratio is calculated, as it appears on screen.
Which WCAG version does this follow?
WCAG 2.0, 2.1 and 2.2 use the same contrast formula and thresholds, so the result is the same for all three.
Is anything uploaded?
No. The check runs in your browser.