Colour contrast checker
Enter a text colour and a background colour to see their contrast ratio, whether they pass WCAG at Level AA and AAA, and the closest text colour that would pass.
Check two colours
A hex code such as #1a1a1a or #fff.
A hex code such as #1a1a1a or #fff.
Contrast 4.47 to 1. Normal text: fails AA.
Contrast ratio: 4.47:1
| Used for | Level | Needs | Result |
|---|---|---|---|
| Normal text (1.4.3) | AA | 4.5:1 | Fails |
| Large text (1.4.3) | AA | 3:1 | Passes |
| Normal text (1.4.6) | AAA | 7:1 | Fails |
| Large text (1.4.6) | AAA | 4.5:1 | Fails |
| Icons, form field borders and other UI parts (1.4.11) | AA | 3:1 | Passes |
Suggested fix
- To reach 4.5:1 (AA for normal text), change the text to
#767676(4.54:1). - To reach 7:1 (AAA for normal text), change the text to
#595959(7.00:1).
What the numbers mean
WCAG measures contrast as a ratio from 1:1 (the same colour twice) to 21:1 (black on white). It compares the relative luminance of the two colours, how bright each looks to the human eye: (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the lighter colour. Green counts most and blue least, because that is how our eyes work.
- Level AA (1.4.3 Contrast (Minimum)): at least 4.5:1 for normal text and 3:1 for large text. This is the level most laws and contracts require.
- Level AAA (1.4.6 Contrast (Enhanced)): at least 7:1 for normal text and 4.5:1 for large text.
- Icons and controls (1.4.11 Non-text Contrast, Level AA): at least 3:1 for the parts of buttons, form fields and icons that people need to see to use them.
Large text means at least 24px (18pt), or at least 18.66px (14pt) if bold. The thresholds are exact: 4.49:1 does not pass 4.5:1, so this checker never rounds a ratio up.
How the suggested colour is chosen
If the pair fails, the checker mixes your text colour towards black (on a light background) or white (on a dark one) in 1% steps and stops at the first mix that passes. The hue stays the same and the change is as small as possible. For example, grey #777777 on white is 4.47:1 and fails AA; the suggestion is #767676 (4.54:1), the lightest grey that passes. If no text colour can reach the target on your background, change the background instead.
Our page scanner uses the same code, so a scan report suggests the same colours.
What a contrast checker can’t tell you
- Text on photos, gradients or semi-transparent backgrounds has no single background colour. Check the lightest and darkest parts behind the text by eye.
- Text in images (logos, banners) has to meet the same ratios, and needs a person to check it.
- Logos and purely decorative text are exempt, and so is text in controls nobody can use (disabled buttons).
- Colour alone shouldn’t carry meaning, such as a link that is only a different colour from the text around it (see links must be distinguishable without relying on colour).
To find every low-contrast element on a page at once, scan the page: the report lists each one with its ratio and a suggested colour. Fix guide: elements must meet minimum colour contrast.