Overview

Text must contrast enough with its background to be readable by people with low vision. WCAG sets the standards.

Enter the text and background colors to check the AA and AAA levels.

Worked examples

InputsResult
Text red (0-255)75Text green (0-255)82Text blue (0-255)89Background red (0-255)255Background green (0-255)255Background blue (0-255)255Contrast ratio: 7.92:1Normal text: AA pass (4.5:1)AAA pass (7:1)Large text: AA pass (3:1)AAA pass (4.5:1)Colors: #4B5259 on #FFFFFF
Show 2 more examples
Text red (0-255)255Text green (0-255)255Text blue (0-255)255Background red (0-255)59Background green (0-255)104Background blue (0-255)252Contrast ratio: 4.59:1Normal text: AA pass (4.5:1)AAA fail (7:1)Large text: AA pass (3:1)AAA pass (4.5:1)Colors: #FFFFFF on #3B68FC
Text red (0-255)33Text green (0-255)36Text blue (0-255)39Background red (0-255)247Background green (0-255)248Background blue (0-255)251Contrast ratio: 14.69:1Normal text: AA pass (4.5:1)AAA pass (7:1)Large text: AA pass (3:1)AAA pass (4.5:1)Colors: #212427 on #F7F8FB

Contrast ratio by text green

With the calculator's starting values, the contrast ratio is 7.92:1. The table shows how it changes with the text green.

Text green (0-255)Contrast ratio
6010.05:1
808.11:1
82starting value7.92:1
1006.43:1
1205.08:1

Other inputs: Text red: 75 0-255 · Text blue: 89 0-255 · Background red: 255 0-255 · Background green: 255 0-255 · Background blue: 255 0-255. Change them in the calculator above for your own numbers.

How it works

Each color’s relative luminance is computed from its linear RGB values. The ratio is (lighter + 0.05) ÷ (darker + 0.05), from 1:1 up to 21:1.

The formula

Contrast = (L1 + 0.05) ÷ (L2 + 0.05)
L1, L2Relative luminance of the lighter and darker color

Practical tips

  • #777777 on white is 4.48:1, which just fails AA for normal text.
  • AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1 and 4.5:1.
  • Large text means at least 18 pt, or 14 pt bold.

Frequently asked questions

Is AA required?

AA is the usual legal and policy standard for websites.

Does this work for transparent colors?

Flatten them against the background first.