Color Contrast Checker
WM-14Type a text color and a background color, such as #767676 on #ffffff, and get the contrast ratio with AA and AAA results for normal and large text.
Runs in your browser. Nothing is uploaded.
Text on background, e.g. #000 on #fff (or two lines)
Contrast result
How to use it
- Write each pair on one line as text on background, for example #000 on #fff. Or put the two colors on two consecutive lines.
- Click Check contrast. You can check many pairs at once.
- Read the ratio and the AA and AAA pass or fail marks.
- Copy the result or download it.
How the ratio is worked out
The page converts each color to relative luminance with the formula in WCAG 2.2, then divides the lighter luminance plus 0.05 by the darker plus 0.05. The result runs from 1:1 for identical colors to 21:1 for black on white. The ratio is shown cut off at two decimals, never rounded up, so a value just under 4.5 shows as 4.49 and fails. For example #767676 on white is 4.54:1 and passes AA for normal text, while #777777 is 4.47:1 and fails.
What counts as a pass
Normal text needs 4.5:1 for AA and 7:1 for AAA. Large text, which is at least 18 point or 14 point bold, needs 3:1 for AA and 4.5:1 for AAA. User interface components and graphics need 3:1 under AA. The first color on each line is the text and the second is the background. The result is only about color. It does not check font size, weight, the real size on your page, or text over images.
Transparent colors
If a color has alpha, the page blends it before measuring: a transparent background is blended over white, and then transparent text over that background, rounded to 8-bit channels. WCAG does not define this step, so use the result as an estimate. Nothing is uploaded.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Expected two colors: write "#000 on #fff", or put the second color on the next line. | There is only one color line and no word on to split it. | Add the second color on the same line after on, or on the next line. |
Colors come in pairs, but there is an odd number of lines. Write "#000 on #fff" on one line, or give the foreground and background on two lines. | Without the word on, colors are paired by lines and one is left over. | Add the missing color, or use on for each pair. |
Questions people ask
What contrast ratio do I need for accessibility?
For WCAG AA, 4.5:1 for normal text and 3:1 for large text and for UI components. For AAA, 7:1 for normal text and 4.5:1 for large text. This page marks each of those as pass or fail.
How is the contrast ratio calculated?
Each color's relative luminance is computed from its linearized sRGB channels with weights 0.2126, 0.7152 and 0.0722. The ratio is (lighter + 0.05) divided by (darker + 0.05). Black on white is 21:1.
What counts as large text in WCAG?
Text of at least 18 point, which is 24 CSS pixels, or at least 14 point if it is bold, which is about 18.7 pixels. Large text has lower contrast requirements because it is easier to read.
Does the order of the two colors matter?
Not for the ratio, which is the same either way. It matters when transparency is involved, because the first color is treated as text blended over the second. The report shows them in that order.
Can it check text over a photo or gradient?
No. It compares two flat colors. For text over an image, pick the lowest-contrast area behind the text and test that color, or add a solid backing behind the text.
About this tool
Computes the contrast ratio with the relative luminance formula from WCAG 2.2: (lighter + 0.05) divided by (darker + 0.05), from 1:1 to 21:1. Write each pair as "text on background", or give the two colors on two consecutive lines; the first is the text. Pass marks are AA 4.5:1 and AAA 7:1 for normal text, AA 3:1 and AAA 4.5:1 for large text (18 pt, or 14 pt bold, and up), and 3:1 for UI components and graphics. The ratio is shown rounded to two decimals, but pass or fail is decided on the unrounded value, so a ratio that displays as 4.50 but is really 4.499 still fails, and the tool says so. Semi-transparent colors are blended first (the background over white, then the text over the background) and rounded to 8-bit, which the standard does not define. It checks color only, not font size, weight or anything else on your page.