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.