HEX Color Validator
Check whether a colour code is valid, and fix it if not.
Check any text and background pair against WCAG AA and AAA.
The declaration appears here
The Color Contrast Checker scores a text and background pair against every WCAG 2.2 rule at once, previews the pair as real text at several sizes, and — when it fails — works out the nearest passing colour that keeps your hue.
Enter a text colour and a background colour and get the contrast ratio between them, scored against every WCAG 2.2 rule at once: 4.5:1 for body text, 3:1 for large text and for user interface components, and the stricter 7:1 and 4.5:1 that AAA asks for.
The ratio alone is easy to misread, so the page shows the pair as real text at 14px, 18px and 24px, plus a bold sample and a button, because a number that passes on paper can still be hard to read — and a number that fails at body size may be perfectly fine for a headline.
When a pair falls short the tool does not stop at telling you so. It works out the nearest passing version of your text colour by adjusting its lightness alone, so the fix keeps the hue you chose rather than replacing it with a generic dark grey.
AA and AAA for normal text, large text and non-text elements, all scored from the one ratio rather than one rule at a time.
The pair drawn at 14px, 18px and 24px, plus bold and a button, because a passing number can still read badly.
The nearest passing colour is found by moving lightness in OKLCH, so your hue survives instead of being replaced by grey.
HEX, RGB, HSL, OKLCH or a CSS colour name — typed, pasted or picked.
The whole calculation runs in your browser, so unreleased brand colours stay on your machine.
Type or pick the text colour and the background colour. Any notation works — HEX, RGB, HSL or a CSS colour name.
The ratio is scored against AA and AAA for normal text, large text and UI components.
Real text at several sizes and weights tells you more than the number on its own.
If the pair fails, click the nearest passing colour to adopt it and re-check.
WCAG 2.2 AA asks for 4.5:1 for normal text, 3:1 for large text (18pt, or 14pt bold, which is roughly 24px and 18.66px bold), and 3:1 for icons, borders and other non-text elements you have to see to use. AAA raises the text figures to 7:1 and 4.5:1.
No. The WCAG formula divides the lighter relative luminance by the darker one, so swapping text and background gives the same ratio. It matters for APCA, which is polarity-aware, but not here.
The WCAG 2.x formula is known to be generous to dark backgrounds and harsh on light ones, because it takes no account of font size, weight or the way the eye adapts. That is exactly why WCAG 3 is being built on APCA instead. Use the previews, not just the number.
Disabled controls are exempt from the WCAG contrast rules, but placeholder text is not — it is real text and needs 4.5:1. The common pale-grey placeholder almost never passes.
What people who use the Color Contrast Checker think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Color Contrast Checker. It takes half a minute and no account.
Write the first reviewCheck whether a colour code is valid, and fix it if not.
Blend two colours and see every step between them.
See your palette as a real interface instead of swatches.
The RAL Classic chart, searchable, with screen approximations.
One colour, every notation — HEX, RGB, HSL, HWB, LAB, LCH and OKLCH.
Work out the solid colour a translucent layer really produces.
Put a gradient on a border — and keep the rounded corners.
The 216 web-safe colours, and why they no longer matter.