Contrast ratio
Contrast ratio measures how different two colours are in brightness, from 1:1 (identical) to 21:1 (black on white). WCAG asks for at least 4.5:1 for normal text and 3:1 for large text.
The ratio compares the relative luminance of the lighter colour (L1) with the darker one (L2) using the formula (L1 + 0.05) / (L2 + 0.05). Hue does not count, only brightness, so a red and a green of similar lightness can have a very low ratio and be hard to tell apart.
For brands this matters when a logo colour is also used for text or buttons. A light yellow that looks fine in a logo can fail as text on white. Check any pair in our contrast checker, which uses the WCAG formula.
Related terms
- Hex colour code: A hex colour code writes a colour as a # followed by six hexadecimal digits: two each for red, green and blue, from 00 to FF. #FF0000 is pure red and #FFFFFF is white.
- WCAG: WCAG (Web Content Accessibility Guidelines) is the W3C standard for making websites usable by people with disabilities. The current version, WCAG 2.2, was published in October 2023.
Sources
- w3.org: Text needs a contrast ratio of at least 4.5:1; large text at least 3:1
- w3.org: Contrast ratio is defined as (L1 + 0.05) / (L2 + 0.05)
More terms in Colour or the full glossary.