Skip to content
ToolZone

Contrast Checker

Measure the contrast ratio between a text color and background color, checking it against WCAG accessibility standards for readability.

Runs in your browser. Nothing you enter or upload leaves your device.

Text color
Background

Accepts hex, rgb() and hsl().

5.16:1

Large text looks like this

Normal body text looks like this. The quick brown fox jumps over the lazy dog.

Small print and captions look like this.

A link
✓ Pass · Normal text AA
Needs 4.5:1 · Body text under 18pt (24px), or 14pt bold
✗ Fail · Normal text AAA
Needs 7:1 · Enhanced level for body text
✓ Pass · Large text AA
Needs 3:1 · 18pt (24px) and up, or 14pt (18.66px) bold
✓ Pass · Large text AAA
Needs 4.5:1 · Enhanced level for large text
✓ Pass · UI & graphics AA
Needs 3:1 · Icons, input borders, focus rings, chart lines

Closest passing colors

Same hue and saturation, lightness nudged just enough. Click to apply.

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the Contrast Checker

Contrast Checker calculates the contrast ratio between a foreground (text) color and a background color using the WCAG formula, then tells you which accessibility levels the pair meets. A live sample shows the actual text on the actual background, so you can judge readability with your own eyes too.

How it works

Each color's red, green and blue values are converted from the 0-255 range to 0-1, linearized with the sRGB gamma curve, and combined into relative luminance as 0.2126 R + 0.7152 G + 0.0722 B. Green gets the largest weight because human eyes are most sensitive to it.

That ratio is compared with the WCAG 2 thresholds: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1, and non-text elements such as icons and input borders need 3:1. The ratio is truncated, not rounded, so 4.499 is never shown as passing. When a level fails, the tool finds the closest passing colors by changing only the lightness of the text or background color.

How to use

  1. 1

    Pick or type the text color (hex, rgb() or hsl()).

  2. 2

    Pick or type the background color, or click the swap button to reverse them.

  3. 3

    Check the ratio and the preview of large, normal and small text, a button and a link.

  4. 4

    Read the five pass or fail tiles, and click a suggested color to fix a failing pair.

Worked examples

Blue link on white

A site uses #2563EB for links on a white page.

Input
Foreground #2563EB, background #FFFFFF
Result
5.17:1 - passes AA Normal, AA Large and AAA Large; fails AAA Normal

5.17 clears the 4.5 bar for AA body text but not the 7.0 bar for AAA.

Gray that just misses

A designer uses mid-gray #777777 for captions.

Input
Foreground #777777, background #FFFFFF
Result
4.48:1 - fails AA Normal, passes AA Large

One step darker, #767676, gives 4.54:1 and passes AA for normal text.

White text on a brand blue button

A button uses white text on #3B82F6.

Input
Foreground #FFFFFF, background #3B82F6
Result
3.68:1 - passes AA Large only

Fine for large, bold button labels, but too low for small text; a darker blue would fix it.

Limitations
Transparency isn't supported, so semi-transparent text must be checked using its blended solid color. It uses the WCAG 2 formula, which doesn't account for font weight or the newer APCA contrast model. Suggested fixes only change lightness; you may prefer a different hue.
Assumptions
Colors are sRGB values as used on the web. The text is rendered as a solid color on a solid background.
Privacy
All calculations run in your browser, and the colors you choose aren't sent or stored.

Frequently asked questions

What contrast ratio do I need to pass WCAG AA?+

At least 4.5:1 for normal text and 3:1 for large text.

What's the difference between WCAG AA and AAA?+

AAA is stricter: 7:1 for normal text and 4.5:1 for large text. AA is the level most laws and accessibility policies require; AAA is a higher target for content where readability is critical.

Does it matter which color is foreground and which is background?+

Not for the ratio itself, which is the same either way. It matters for the suggested fixes, which change the text color or the background separately.

What is the highest possible contrast ratio?+

21:1, which is pure black (#000000) against pure white (#FFFFFF).

Why does the ratio use + 0.05?+

The 0.05 represents ambient light reflecting off the screen. It keeps the ratio finite for pure black and reflects that real screens are never perfectly dark.

Related tools