Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

WCAG Contrast Checker

Check the contrast ratio between a text color and a background, with WCAG AA/AAA pass or fail for normal and large text. Runs in your browser.

Accepts hex, rgb() or hsl(). Use the swatches to pick.

Sample text — Aa

    

What it does

Enter a text colour and a background colour and this tool reports the WCAG contrast ratio between them, plus a pass/fail verdict at the AA and AAA thresholds for both normal and large text. Colours can be written as hex (#1a1a1a or the shorthand #abc), rgb() or hsl(); the swatch pickers write hex back into the text fields. The live preview paints your two colours together so you can judge legibility by eye as well as by number.

How the ratio is calculated

The ratio follows the WCAG 2 formula (L1 + 0.05) / (L2 + 0.05), where L1/L2 are the lighter and darker colours' relative luminance. Luminance is computed by linearising each sRGB channel (the ≤ 0.03928 / gamma 2.4 curve) and weighting them 0.2126 R + 0.7152 G + 0.0722 B. Values run from 1:1 (identical colours) to 21:1 (pure black on pure white).

What the levels mean

WCAG requires at least 4.5:1 for normal text (AA) and 3:1 for large text — large being roughly 18.66px bold or 24px regular and up. AAA raises those to 7:1 and 4.5:1. The same 3:1 minimum (AA) also applies to UI components and graphical objects such as icons and form borders.

Gotchas

  • Contrast ignores hue — two colours can look very different yet still fail, which is why a red/green pairing can read fine to you but fail for low-vision or colour-blind users.
  • Semi-transparent text (an rgba() alpha, or opacity) is not what the eye sees against the page; test the colour as it actually composites over its real background.
  • Antialiased thin or light-weight fonts look lower-contrast than the maths suggests, so leave headroom rather than sitting exactly on 4.5:1.

Worked examples

#767676 text on #ffffff gives 4.54:1 — it just passes AA for body text but fails AAA. Lighten the grey to #808080 and it drops to 3.95:1, failing AA for normal text while still passing for large headings. Use this to tune a grey until it clears the bar you need.

Reach for this tool when picking body-text colours, link and button states, placeholder text, or chart labels. For converting or exploring the colours themselves, see the Color converter.

Privacy

All calculation is local; nothing is uploaded.

Frequently asked questions

What contrast ratio do I need to pass WCAG?

For AA, normal text needs at least 4.5:1 and large text (about 18.66px bold or 24px regular) needs 3:1. AAA raises those to 7:1 and 4.5:1. UI components and meaningful graphics need 3:1 against adjacent colours.

Why does my red-on-green still fail even though I can read it?

The contrast ratio is based only on relative luminance, not hue. Two colours with similar brightness score poorly no matter how different their colours look, and that low score reflects how the pairing reads for low-vision and colour-blind users.

Does the tool handle rgb() and hsl(), not just hex?

Yes. You can type hex (including 3-digit shorthand), rgb()/rgba() or hsl()/hsla(). The alpha value is parsed but the ratio is computed from the opaque RGB, so test transparent colours as they composite over their real background.

Related tools