What the contrast ratio tells you
The contrast ratio compares how light two colors are, from 1:1 for two identical colors to 21:1 for black on white. The Web Content Accessibility Guidelines (WCAG) set minimum ratios so text stays readable for people with low vision or color vision deficiencies, and on dim screens or in bright light.
Large text needs less contrast than body copy because its letterforms are easier to make out. WCAG counts text as large from 18 pt (24 px), or from 14 pt (about 18.7 px) when it is bold. This tool uses the WCAG 2.x ratio; newer methods such as APCA measure contrast differently and are not part of WCAG 2.
- Normal text: 4.5:1 for level AA, 7:1 for level AAA
- Large text: 3:1 for level AA, 4.5:1 for level AAA
- Icons, input borders, focus rings and chart lines (WCAG 2.1, success criterion 1.4.11): 3:1 against the colors next to them
How the ratio is calculated
Each color is turned into a relative luminance between 0 (black) and 1 (white). The red, green and blue channels are first converted from their screen values to linear light, then weighted by how bright each one looks to the eye: green counts most, blue least.
The ratio then divides the lighter luminance by the darker one, each plus 0.05. The thresholds are exact, so 4.49:1 does not pass a 4.5:1 requirement.
Channel c = value ÷ 255 Linear = c ÷ 12.92 if c ≤ 0.04045, else ((c + 0.055) ÷ 1.055)^2.4 L = 0.2126 × R + 0.7152 × G + 0.0722 × B Ratio = (L lighter + 0.05) ÷ (L darker + 0.05) #767676 on #FFFFFF: L = 0.1812 and 1 (1 + 0.05) ÷ (0.1812 + 0.05) = 4.54:1
Checking colors in studio work
Contrast problems are cheapest to fix while a palette is still a proposal. Check brand colors against the backgrounds they will actually sit on, light and dark, before they go into a style guide or a client presentation.
If a brand color fails for body text, it can often still work for large headings, icons or backgrounds, with a darker or lighter shade for text.
- Check every state, not just the default: links, hover and focus colors, placeholder text and error messages
- For text on a photo or a gradient, check against the lightest and the darkest area behind the text
- Do not use color as the only signal: pair red and green states with words or icons
- Logos and inactive (disabled) controls have no contrast requirement under WCAG