Color contrast checker
Type two colors, see the WCAG ratio and what passes, then fix a failing pair with one click.
Free to use, no sign-up.
How it works
- Enter a text colour and a background colour as hex, rgb(), hsl() or a name, or use the pickers. Press Check contrast.
- Read the ratio and the pass or fail result for normal text, large text and UI components at AA and AAA, with a live preview.
- If a pair fails, pick the level you need and use the nearest passing colour, which keeps the hue and changes only the lightness. Paste a whole palette to see every combination at once.
Questions
What contrast ratio does WCAG require?
For level AA, normal text needs at least 4.5:1 and large text needs at least 3:1. For level AAA the numbers are 7:1 and 4.5:1. User interface components such as input borders and icons need 3:1 against their surroundings. Large text means 18pt (24px) or more, or 14pt (about 18.7px) or more in bold.
How is the contrast ratio calculated?
Each colour is converted to a relative luminance using the WCAG 2.x formula, then the ratio is (lighter + 0.05) divided by (darker + 0.05). The result runs from 1:1 (identical colours) to 21:1 (black on white). This tool cuts the ratio off after two decimals instead of rounding up, so a pair at 4.499 is never shown as passing at 4.50.
How does the nearest passing colour work?
It keeps the hue and saturation of your colour and moves only the lightness, towards black or white, until the pair reaches the ratio you chose. It picks whichever direction needs the smaller change. If your colour already passes, it says so and changes nothing. You can fix either the text or the background.
Does it handle transparent colours?
Yes. A translucent text colour is blended over the background first, and a translucent background is blended over white, because that is what a visitor would see. Use hex with alpha such as #00000080, or rgba().
Does a pass here mean my site meets WCAG?
No. Contrast is one requirement among many. This checks the colours you enter against WCAG 2.x contrast thresholds. It cannot see text over images or gradients, hover and focus states, or whether the colour is the only way a meaning is shown. Test those separately.
Are my colours uploaded anywhere?
No. Everything is calculated in your browser. Nothing you enter is uploaded, saved or tracked.
Free tool by Huntsville Software. It runs in your browser; your files and text are not uploaded.