About Color Contrast Checker
Gray text on white looks elegant on a designer's calibrated monitor and is a struggle on a phone in sunlight or for anyone with low vision. WCAG, the standard behind most accessibility laws and audits, sets numeric contrast thresholds for this. Enter two colors and this page tells you which ones they meet.
A failing result is usually where the work starts, so the tool also suggests a fix. It finds the nearest text color, in the same hue and saturation, that passes AA and AAA against your background, and one click applies it. The preview shows the pair at real text sizes.
How it works
Each color is converted from sRGB to linear light, channel by channel, then weighted to give relative luminance: L = 0.2126 R + 0.7152 G + 0.0722 B. The ratio is (L1 + 0.05) / (L2 + 0.05), with the lighter color on top, so it runs from 1:1 to 21:1. WCAG 2.2 uses a threshold of 0.04045 in the first step where older versions printed 0.03928. At 8 bits per channel both give identical results, because no 8-bit value falls between them.
The ratio is always rounded down for display, because 4.499 shown as 4.50 would look like a pass while actually failing. #777777 on white shows 4.47:1 and fails the 4.5 threshold, while the nearly identical #767676 reaches 4.54:1 and passes.
How to use Color Contrast Checker
- Enter the Text color and the Background color, or use the color boxes.
- Read the ratio and the verdict under it.
- Check the five Pass or Fail cards for the level you need.
- If it fails, press Use it on a suggested color, or Copy to take the value elsewhere.
The classic gray on white
Text #777777 on background #ffffffRatio: 4.47:1
AA normal text (4.5:1): Fail
AA large text (3:1): Pass
Nearest AA text color: #767676A difference of one step per channel moves this pair across the line, which is why you should measure rather than judge by eye. The suggested color reaches 4.54:1.
When it helps
- Checking body text and link colors before a design goes to development.
- Answering an accessibility audit item with a measured ratio.
- Testing a button label, a placeholder, or a dark mode pair.
- Adjusting a brand color by the smallest amount needed so it can be used for text.
Tips for a better result
- Large text means at least 24 px, or about 18.7 px when bold. Anything smaller needs the 4.5:1 ratio, whatever it looks like.
- Check your states as well, since hover colors, disabled buttons and placeholder text are the usual failures.
- Interface parts such as input borders and icons need 3:1 against what is next to them, under WCAG criterion 1.4.11.
- Test text over an image or gradient at its lightest and darkest points.
Good to know
- It checks solid colors only. Transparency in a code you enter is ignored, so work out the blended color first.
- WCAG ratios do not account for font weight beyond the large text rule, or for how thin a typeface is. A pass does not guarantee comfortable reading.
- APCA, the draft contrast method under discussion for a future WCAG version, is not calculated here.
- Conformance needs more than color contrast. This is one check in a wider accessibility review.
Questions people ask
What contrast ratio does WCAG require?
Level AA requires 4.5:1 for normal text and 3:1 for large text. Level AAA requires 7:1 for normal text and 4.5:1 for large text. Interface parts need 3:1.
Which should I aim for, AA or AAA?
AA is the usual legal and contract target. WCAG itself notes that AAA cannot be met for all content, so use it where you can, especially for long reading.
Does it matter which color is the text?
Not for the ratio, which is the same both ways round. It does matter for the suggestion, which changes only the text color, so use Swap to adjust the other one.
Why might my design tool show a different number?
Tools may round up, or test a color with opacity blended differently. This one rounds down so that a displayed pass is always a real pass.
What to use next
- Color Picker: to fine-tune a suggested color and get it in other formats
- Color Palette Generator: to rebuild a palette around a color that passes
- Image Color Picker: to read a background color from a screenshot of a live page
Last reviewed . Read our editorial policy.