Colour contrast checker

Enter a text colour and a background colour to see their contrast ratio, whether they pass WCAG at Level AA and AAA, and the closest text colour that would pass.

Check two colours

A hex code such as #1a1a1a or #fff.

A hex code such as #1a1a1a or #fff.

Contrast 4.47 to 1. Normal text: fails AA.

Contrast ratio: 4.47:1

#777777 on #ffffff against WCAG
Used forLevelNeedsResult
Normal text (1.4.3)AA4.5:1Fails
Large text (1.4.3)AA3:1Passes
Normal text (1.4.6)AAA7:1Fails
Large text (1.4.6)AAA4.5:1Fails
Icons, form field borders and other UI parts (1.4.11)AA3:1Passes

Suggested fix

  • To reach 4.5:1 (AA for normal text), change the text to #767676 (4.54:1).
  • To reach 7:1 (AAA for normal text), change the text to #595959 (7.00:1).

What the numbers mean

WCAG measures contrast as a ratio from 1:1 (the same colour twice) to 21:1 (black on white). It compares the relative luminance of the two colours, how bright each looks to the human eye: (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the lighter colour. Green counts most and blue least, because that is how our eyes work.

Large text means at least 24px (18pt), or at least 18.66px (14pt) if bold. The thresholds are exact: 4.49:1 does not pass 4.5:1, so this checker never rounds a ratio up.

How the suggested colour is chosen

If the pair fails, the checker mixes your text colour towards black (on a light background) or white (on a dark one) in 1% steps and stops at the first mix that passes. The hue stays the same and the change is as small as possible. For example, grey #777777 on white is 4.47:1 and fails AA; the suggestion is #767676 (4.54:1), the lightest grey that passes. If no text colour can reach the target on your background, change the background instead.

Our page scanner uses the same code, so a scan report suggests the same colours.

What a contrast checker can’t tell you

To find every low-contrast element on a page at once, scan the page: the report lists each one with its ratio and a suggested colour. Fix guide: elements must meet minimum colour contrast.