How to use the contrast checker
- Enter the text color and the background color. Type a HEX code, an rgb() or hsl() value or a color name, or click the color square to choose one. In Chrome and Edge on a computer, Pick takes a color straight from your screen.
- Read the ratio and the results. The table shows at once whether the pair passes WCAG AA and AAA for normal text, for large text and for icons and input borders.
- Look at the preview. It shows real text at different sizes, a button outline and an icon in your colors.
- Fix a failing pair. Under “Nearest colors that pass” you get the closest text color, and the closest background when one exists, that reach AA and AAA. Press Use to apply one.
- See-through text? Lower the opacity; the checker blends the text with the background, the way the browser shows it.
- Share it. The page address holds both colors, so Copy link sends someone exactly this check.
What the contrast ratio means
The contrast ratio compares how much light the lighter color gives off with how much the darker one does. It runs from 1:1, when the two colors are the same, to 21:1, for black on white. Hue doesn’t enter into it: a red and a green with the same brightness have a ratio close to 1:1, which is why they are hard to tell apart for many people.
The formula comes from the Web Content Accessibility Guidelines. Each color’s relative luminance L is worked out from its red, green and blue values (each converted from the screen’s gamma to linear light, then weighted 21% red, 72% green and 7% blue, because the eye is most sensitive to green). The ratio is then (L1 + 0.05) ÷ (L2 + 0.05), with L1 the lighter color. The 0.05 stands for the glare of a typical screen.
WCAG AA and AAA levels
| What | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text (24 px, or 18.7 px bold) | 3:1 | 4.5:1 |
| Icons, input borders, focus outlines, chart lines | 3:1 | – |
AA is the level most laws and policies point to, including the European accessibility standard EN 301 549 and the US Department of Justice rule for state and local government websites under the Americans with Disabilities Act, which adopts WCAG 2.1 AA. AAA is a stricter target that helps people with low vision even more. The text rules are WCAG success criteria 1.4.3 and 1.4.6, and the rule for icons and controls is 1.4.11.
Examples
| Text | Background | Ratio | Result |
|---|---|---|---|
| #000000 | #FFFFFF | 21.00:1 | AAABlack on white, the highest possible contrast |
| #767676 | #FFFFFF | 4.54:1 | AAThe lightest gray that still passes AA on white |
| #777777 | #FFFFFF | 4.47:1 | Large text onlyOne step lighter, and it fails AA |
| #595959 | #FFFFFF | 7.00:1 | AAAThe lightest gray that passes AAA on white |
| #0000EE | #FFFFFF | 9.39:1 | AAAThe classic blue of an unvisited link |
| #FFFFFF | #2563EB | 5.16:1 | AAWhite on a strong blue button |
| #FFFFFF | #16A34A | 3.29:1 | Large text onlyWhite on a bright green button |
| #FFFFFF | #F59E0B | 2.14:1 | FailsWhite on amber, a common warning color |
| #1F2937 | #F59E0B | 6.83:1 | AADark text on the same amber |
Bright, saturated colors such as green, amber and light blue are often too light for white text. Darker text on them, or a darker shade of the color, usually fixes it.
How to fix low contrast
- Change lightness, not hue. A darker version of a brand color usually keeps the look while passing. The suggestions here do exactly that.
- Use the large-text allowance with care. 3:1 is only enough for text that is really large; a 16 px label with 3.5:1 still fails.
- Check every state. Placeholder text, hover and focus colors, links and text over images all need checking, not just the main text.
- Don’t rely on color alone. Pair color with words, icons or underlines, so links and error messages work for people who see colors differently.
- Check dark mode separately. A color that works on white can fail on a dark background, and the other way round.
APCA, the newer contrast method
APCA (Accessible Perceptual Contrast Algorithm) rates contrast as a lightness contrast value, Lc, from about 0 to 106 for dark text on light backgrounds and to −108 for light text on dark ones. It models human vision more closely than the WCAG 2 ratio, especially for dark backgrounds and thin fonts, and it ties the value you need to the size and weight of the text. Lc 75 is a common minimum for body text and Lc 90 is preferred. APCA is being considered for WCAG 3, which is still a draft, so the checker shows it for information; to meet today’s requirements, use the ratio.
Contrast and color blindness
According to the US National Eye Institute, about 1 in 12 men have a color vision deficiency, and women much less often; the most common type makes red and green hard to tell apart. The previews show your pair as it may look with each of the main types, simulated with the Machado, Oliveira and Fernandes model. Because the contrast ratio measures lightness, a pair that passes usually stays readable, but colors that differ only in hue can look the same.
To find exact codes for a color, use the color picker, which also shows how a color works against white and black.
Frequently asked questions
What contrast ratio does WCAG require?
For level AA, normal text needs at least 4.5:1 against its background and large text needs 3:1. For level AAA, normal text needs 7:1 and large text 4.5:1. Icons, input borders, focus outlines and other parts you need to see to use a page need 3:1 (success criterion 1.4.11).
What counts as large text?
WCAG defines large text as at least 18 point (24 CSS pixels) in a regular weight, or at least 14 point (about 18.7 CSS pixels) in bold. Anything smaller is normal text and needs the higher ratio.
Is 4.49:1 close enough to pass 4.5:1?
No. The WCAG thresholds are minimums, so 4.49:1 fails AA for normal text. This checker shows the ratio to two decimals without rounding up, so a value shown as 4.50:1 really passes.
How does the checker suggest a passing color?
It keeps the hue of your color and changes only its lightness, moving it away from the other color (dark text gets darker, light text lighter) just until the contrast reaches the level you need, so the design keeps its light-on-dark or dark-on-light look. It suggests a new background the same way, when one is possible. Press Use to try a suggestion.
What is the APCA number?
APCA (Accessible Perceptual Contrast Algorithm) is a newer way to measure contrast that is being considered for WCAG 3, which is still a draft. It is shown for information only. Today’s standards, such as WCAG 2.2, EN 301 549 and the US Justice Department’s ADA rule for public websites, use the contrast ratio.
Do logos and disabled buttons need enough contrast?
WCAG makes exceptions for text in logos and brand names, for purely decorative text and for inactive (disabled) controls. They are still easier for everyone to see with good contrast, but they don’t fail the guideline.
Are my colors sent anywhere?
No. Everything is calculated in your browser. The two colors are kept in the page address so you can bookmark or share the check, and nothing is uploaded.