
How to use
- Enter the text and background colors as HEX values, or pick them with the color pickers.
- Read the contrast ratio (1:1 to 21:1) and whether the pair passes WCAG AA and AAA for normal and large text, with a live preview.
- Use the swap button to flip text and background colors.
WCAG contrast requirements
The Web Content Accessibility Guidelines (WCAG 2.1 and 2.2) set minimum contrast ratios between text and its background so that people with low vision or color blindness, and anyone reading a phone in sunlight, can read it.
| Level | Normal text | Large text |
|---|---|---|
| AA (the usual legal and design target) | 4.5:1 | 3:1 |
| AAA (enhanced) | 7:1 | 4.5:1 |
| Icons, buttons, form borders (AA) | 3:1 | 3:1 |
What counts as large text
Large text is at least 18 point (24 CSS pixels) regular, or 14 point (about 18.7 CSS pixels) bold. Most body text, labels and links are normal text and need 4.5:1. Headings above that size can pass at 3:1.
Examples that catch people out
Light gray text is the most common failure. On a white background, #767676 reaches 4.54:1 and passes AA, but the slightly lighter #777777 is 4.48:1 and fails. #959595 is exactly 3:1, enough only for large text. White text on yellow (#FFFF00) is about 1.07:1, close to invisible.
Brand colors often pass for headings but not for small text, so test each real pair: the button label on the button, the link on the page background, and placeholder text in form fields, which is easy to forget.
How the ratio is calculated
Each color is converted to relative luminance, a measure of perceived brightness from 0 (black) to 1 (white), after correcting for the sRGB gamma curve. The ratio is (lighter + 0.05) ÷ (darker + 0.05), which runs from 1 to 21. Hue does not matter on its own: red text on green can have poor contrast even though the colors look very different.
Frequently asked questions
What contrast ratio do I need for WCAG AA?
4.5:1 for normal text and 3:1 for large text (18 pt regular or 14 pt bold and larger).
Does WCAG AA apply to logos?
No. Text that is part of a logo or brand name has no contrast requirement, and neither does purely decorative text or disabled controls.
Is AAA required?
Usually not. Rules and standards generally require level AA: the US Department of Justice's 2024 rule for state and local government websites and the European standard EN 301 549 both use WCAG 2.1 AA. AAA is a good goal for long reading text.
Are my colors sent anywhere?
No. The ratio is calculated in your browser.