Home › Design Tools › Colour Contrast Checker

Colour Contrast Checker

Check text and background colours against the WCAG contrast levels.

The quick brown fox jumps over the lazy dog.
Contrast ratio-

Results

AA, normal text (4.5:1)-
AA, large text (3:1)-
AAA, normal text (7:1)-
AAA, large text (4.5:1)-
Large text means 24px or more, or 18.66px or more when bold. The thresholds are from WCAG 2.2 success criteria 1.4.3 (Contrast, minimum) and 1.4.6 (Contrast, enhanced). Non-text elements such as icons and form borders need 3:1 under criterion 1.4.11.

How to use

  1. Set the Text colour. Click the colour swatch to pick one, or type a hex value such as #1b1d33 or #fff into the box next to it.
  2. Set the Background colour the same way.
  3. Read the Contrast ratio. The sample line shows your two colours together.
  4. Under Results, each row shows Pass or Fail for one level: AA or AAA, for normal or large text.
  5. If a row fails, change one colour and check again. Darken the text or lighten the background until the level you need passes.

If the hex value is not valid, an error appears and the results are not updated until you fix it.

Worked example

The default pair is dark navy text #1b1d33 on white. The ratio is 16.53 : 1, so it passes all four levels. Now try mid grey text on white:

TextBackgroundRatioAA normal (4.5)AA large (3)
#777777#ffffff4.48 : 1FailPass
#767676#ffffff4.54 : 1PassPass
#0066cc#ffffff5.57 : 1PassPass
#ff6600#ffffff2.94 : 1FailFail

One step of grey, from 77 to 76, turns a fail into a pass. Black on white gives the maximum, 21 : 1, and identical colours give the minimum, 1 : 1.

How it works

Each colour's relative luminance is calculated from its red, green and blue values, linearised as WCAG defines it. The contrast ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05). Everything runs in your browser.

Relative luminance. Each channel is divided by 255 to give c. If c is 0.03928 or less, the linear value is c / 12.92. Otherwise it is ((c + 0.055) / 1.055) raised to the power 2.4. Luminance is then 0.2126 x R + 0.7152 x G + 0.0722 x B. Green weighs most because the eye is most sensitive to it. The formula is in the WCAG 2.2 definition of relative luminance.

Contrast ratio. The 0.05 added to both luminances stands in for ambient light reflected from the screen. The ratio runs from 1 to 21. See the WCAG definition of contrast ratio.

The levels. Level AA needs 4.5 : 1 for normal text and 3 : 1 for large text. Level AAA needs 7 : 1 and 4.5 : 1. The explanations are on the W3C pages for 1.4.3 Contrast (Minimum) and 1.4.6 Contrast (Enhanced). The ratio is shown to two decimal places, but the pass test uses the unrounded value.

Common mistakes

Frequently asked questions

What counts as large text?

Text of 24px or more, or 18.66px or more in bold. That is 18pt and 14pt bold in WCAG's wording.

Is a passing ratio enough for accessibility?

No. Contrast is one requirement. Colour blindness, font weight, thin strokes and screen glare also matter, and some people prefer lower contrast.

Which level should I aim for?

AA is the usual legal and procurement target. Use AAA for long reading text where you can.

Why does it only accept hex?

Hex is the common way to write a colour in design files. Use the Colour Converter to turn RGB or HSL into hex first.

Are my colours saved?

No. Nothing leaves your browser.

Related tools