color contrast checker
Enter a text colour and a background colour to see their WCAG contrast ratio and whether they pass AA and AAA. If they don't, the checker suggests the closest colour that does. Type hex, rgb(), hsl() or a colour name.
Large text sample
Body text at normal size. The quick brown fox jumps over the lazy dog, 0123456789.
button outlineWCAG contrast rules at a glance
| What | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text (24px+, or 18.66px+ bold) | 3:1 | 4.5:1 |
| Icons, input borders, focus rings, chart lines | 3:1 | — |
| Logos and purely decorative text | no requirement | |
Most accessibility laws and procurement rules, such as the European Accessibility Act and the US Section 508 standard, point to WCAG level AA, so 4.5:1 for body text is the number to aim for.
Real examples
| Text on background | Ratio | AA text | Note |
|---|---|---|---|
| #767676 on #FFFFFF | 4.54:1 | pass | the lightest gray that passes AA on white |
| #777777 on #FFFFFF | 4.47:1 | large only | one step lighter, which fails |
| #FFFFFF on #0000FF | 8.59:1 | pass | white on pure blue |
| #FFFFFF on #FF0000 | 3.99:1 | large only | white on pure red |
| #000000 on #FFFF00 | 19.55:1 | pass | black on yellow |
| #FFFFFF on #008000 | 5.13:1 | pass | white on CSS green |
Tips for readable colours
- Mid-tones are the problem: colours around 50% lightness rarely pass with either black or white text.
- Colour alone shouldn't carry meaning. Pair red and green states with icons or text for colour-blind readers.
- Placeholder text and disabled buttons are often too light; check them too.
- Dark mode needs its own check: light gray text on dark gray can fail just as easily.
Frequently asked questions
What contrast ratio do I need?
WCAG 2 level AA needs at least 4.5:1 for normal text and 3:1 for large text (24px, or 18.66px bold, and above). Level AAA needs 7:1 for normal text and 4.5:1 for large text. Icons, form borders and other interface parts need 3:1 against what's next to them.
How is the contrast ratio calculated?
Each colour's relative luminance is worked out from its sRGB values, with the gamma curve removed. The ratio is (lighter + 0.05) ÷ (darker + 0.05), so it runs from 1:1 (same colour) to 21:1 (black on white).
Why does the tool round the ratio down?
WCAG compares the exact ratio with the threshold. A ratio of 4.499:1 fails AA even though it would round up to 4.5, so the ratio is shown rounded down to two decimals to avoid a false pass.
What does the suggested colour do?
If your pair fails AA, the tool keeps the hue and saturation of your colour and changes only its lightness, by the smallest amount needed to reach 4.5:1. Click it to apply it.
Does it check transparent colours or images?
No. It compares two solid colours. For text over a photo or gradient, check the lightest and darkest parts of the background behind the text.
Is this the same as APCA?
No. APCA is a newer contrast method being explored for future guidelines. This checker uses the WCAG 2.x formula, which is what accessibility laws and audits refer to today.