Skip to content
Language:en

Color contrast checker

WCAG contrast ratio between a text colour and a background, with AA and AAA pass or fail.

Runs entirely in your browser. Your files never leave your device.

About this tool

Light grey text on white looks elegant on a designer’s screen and unreadable on a phone in the sun. The Web Content Accessibility Guidelines measure readability with a contrast ratio, from 1:1 for identical colours to 21:1 for black on white. Pick a text colour and a background, or paste hex or rgb() codes, and see the ratio with a live sample.

The results tell you at once which WCAG 2 levels pass. Level AA, the usual legal and contractual target, needs 4.5:1 for body text and 3:1 for large text and for interface parts such as button borders and icons. Level AAA asks for 7:1 and 4.5:1. Ratios are truncated, never rounded up, so a borderline colour is not shown as passing.

How it works

  1. Pick or paste the text colour.
  2. Pick or paste the background colour.
  3. Read the ratio and the AA and AAA results.
  4. Adjust until the levels you need pass.

Ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 and L2 are the relative luminances of the lighter and darker colours, computed from linearised sRGB channels.

Worked example

Grey text #777777 on white has a ratio of 4.48:1: it just misses AA for body text, which needs 4.5:1. Darken it one notch to #767676 and the ratio becomes 4.54:1, a pass that looks the same to most eyes.

White text on a #3B82F6 blue button reaches about 3.7:1: fine for large bold text, too low for small labels. A darker blue such as #2563EB passes 4.5:1.

Good to know

  • Test the real pairs of your design, including placeholders, disabled states and text over images.
  • Large text means at least 24 px regular or about 18.7 px bold.
  • Contrast is not the only cue: links and errors should not rely on colour alone.

Frequently asked questions

What counts as large text?
At least 18 point (24 px) regular, or 14 point (about 18.7 px) bold. Large text only needs 3:1 at level AA.
Does the order of the colours matter?
No. The ratio is the same whichever colour is the text, since it compares the lighter and the darker one.
Is WCAG 2 contrast the only rule?
It is the one cited by laws and audits today. Newer methods such as APCA weigh font size and weight more finely, but are not yet a standard requirement.