Lab
Contrast checker
Pick a text colour and a background colour. It computes the WCAG 2.x contrast ratio and tells you which levels pass. Everything runs in your browser; no colour is sent anywhere.
Body text: the quick brown fox jumps over the lazy dog.
Large text: the quick brown fox.
Contrast ratio
17.20:1
Normal text
Large text (18pt, or 14pt bold)
AA needs 4.5:1 for normal text and 3:1 for large text. AAA needs 7:1 and 4.5:1. Large means 18pt (24px), or 14pt (about 18.7px) bold.
Examples
Worked examples
Five colour pairs, each run through the checker. Read the verdict as text: every result is written out, not shown by colour alone.
| Text | Background | Ratio | Normal text | Large text |
|---|---|---|---|---|
| #767676 | #ffffff | 4.54:1 | AA pass, AAA fail | AA pass, AAA pass |
| #94a3b8 | #ffffff | 2.56:1 | AA fail, AAA fail | AA fail, AAA fail |
| #1d4ed8 | #ffffff | 6.70:1 | AA pass, AAA fail | AA pass, AAA pass |
| #ffffff | #2563eb | 5.17:1 | AA pass, AAA fail | AA pass, AAA pass |
| #06b6d4 | #0d1117 | 7.79:1 | AA pass, AAA pass | AA pass, AAA pass |
#94a3b8 on white is a common grey for secondary text. At 2.56:1 it fails every level, for normal and large text alike.
Method
How the ratio is computed
Each sRGB channel c (0 to 1) is linearised: c / 12.92 when c is 0.03928 or less, otherwise ((c + 0.055) / 1.055)^2.4. The relative luminance is L = 0.2126 R + 0.7152 G + 0.0722 B, using the linear values. The ratio is (L_light + 0.05) / (L_dark + 0.05), from 1:1 (no difference) to 21:1 (black on white).
The thresholds are AA 4.5:1 and 3:1 for large text, AAA 7:1 and 4.5:1 for large text. They come from WCAG 2.x, success criteria 1.4.3 and 1.4.6.
Edge cases
What trips people up
- Large text is 18pt (24px) or more in regular weight, or 14pt (about 18.7px) or more in bold. A 16px heading is normal text, however big it looks next to the body.
- The ratio uses the two solid colours only. Images, gradients, shadows, transparency and overlays are not measured. Check the text against the real background behind it, at its lightest and darkest points.
- The checker reads 3- and 6-digit hex values. Colours with an alpha channel are not accepted, so flatten them to a solid colour first.
- Non-text elements such as icons, input borders and focus rings have their own 3:1 rule (WCAG 1.4.11). This tool does not check them.
- Passing a ratio does not replace testing with users. It says the two colours meet a formula. It does not say the text is comfortable to read on every screen, in bright light, or for someone with low vision.