Color Contrast Checker
Checks text and background contrast by WCAG 2.1: shows the ratio from 1:1 to 21:1 and says whether the pair passes AA, AAA and the 3:1 bar for UI elements.
Input
Report a problem
How color contrast is calculated
What this checker does
You pick a text color and a background color. The checker shows their contrast – a number from 1:1 to 21:1 – and says whether it is enough for levels AA and AAA and for icons and input fields. Black text on white gives 21:1, the same color on the same color gives 1:1.
Where the number comes from
First each color is turned into luminance: the R, G and B channels are stretched by the WCAG formula and added with different weights – green counts the most, blue the least. Then the lighter color is divided by the darker one, with 0.05 added to both. That is why the contrast does not depend on which color you called the text: a pair stays a pair.
Levels AA and AAA
AA is the bar most requirements set: 4.5:1 for normal text and 3:1 for large text. AAA is stricter: 7:1 and 4.5:1. Gray #767676 on white gives 4.54:1 and passes AA, while #777777 gives 4.47:1 and fails, even though the eye cannot see the difference.
Large text
WCAG counts text as large from 24 px, and bold text from 18.66 px. These are the same 18 pt and 14 pt bold from the standard, turned into pixels. Size does not change the contrast, only which bar is applied to it.
Icons and input fields
The third row is the 3:1 bar for things that are not text: field borders, icons, lines on a chart. It is easy to forget, because such elements look "good enough" until someone opens the page in the sun.
Transparency and gradients
The checker works with solid colors. If text sits on a semi-transparent layer, a gradient or a photo, it has no contrast of its own until the layers are blended. Take the color you see on screen with an eyedropper and enter it.
Common questions about contrast
Can I enter a color by name, like "red"?
No, only hex: #rrggbb or the short #abc. Color names differ between environments, while a hex code means one thing.
Why is the number rounded down?
So that 4.499 does not read as 4.5. Rounding up would turn "fails" into "passes" where a real check would reject it.
Does the result change if I swap the colors?
No. The formula divides the lighter color by the darker one, so the pair gives the same number both ways.
My text is on a gradient – what do I do?
Check the two ends of the gradient on their own: the lightest and the darkest. The worse of the two has to pass.