Color Contrast Checker

Use this free color contrast checker to compare two hex colors, calculate contrast ratio, and see WCAG AA and AAA pass or fail results.

All tools
Illustration for Color Contrast Checker showing check WCAG contrast ratio for text and background hex colors.
Color Contrast Checker artwork matches the live tool workflow: check WCAG contrast ratio for text and background hex colors. Use it with the calculator, examples, and result notes. View in the smoke-kawaii gallery
Inputs explained Result checks Example values Runs in your browser
Contrast ratio17.7465943159:1

#101828 on #ffffff

AA normal text
Pass
AA large text
Pass
AAA normal text
Pass
AAA large text
Pass

WCAG AA uses 4.5:1 for normal text and 3:1 for large text. Also check focus, hover, disabled, and icon states.

Formula steps

  1. Convert each hex color to sRGB channel values.
  2. Calculate relative luminance for foreground and background.
  3. Use the WCAG contrast formula: (lighter + 0.05) / (darker + 0.05).

How to use the Color Contrast Checker

  1. Enter foreground and background colors as #RGB or #RRGGBB hex values.
  2. Press Check contrast to calculate the contrast ratio.
  3. Read AA and AAA pass/fail results for normal and large text.
  4. Also check hover, focus, selected, disabled, icon, and real-page states before publishing.

What people use it for

Check text color against a page background before publishing.

Compare brand colors against WCAG AA and AAA thresholds.

Test button, label, and navigation color pairs.

Quickly reject low-contrast combinations during design work.

Quick examples

Dark on white

#101828 on #ffffff

17.7465943159:1, AA and AAA normal pass

Muted text

#667085 on #f9fafb

4.7604112926:1, AA normal pass and AAA normal fail

Near miss

#777777 on #ffffff

4.4780894536:1, AA normal fail but large text passes

Need the guide or a nearby tool?

Need a slower walkthrough, a related tool, or the full library? These links keep you close to the task you started.

Frequently asked questions

Plain-language answers about when to use the tool, what it does with your inputs, what to double-check, and how privacy works.

When should I use the Color Contrast Checker?

Use it when your task matches one of these common needs: Check text color against a page background before publishing. Compare brand colors against WCAG AA and AAA thresholds. It works best when you already know the exact foreground text color and background color as #RGB or #RRGGBB hex values.

What is the Color Contrast Checker doing with my inputs?

In plain language: The checker normalizes #RGB or #RRGGBB hex colors, converts each sRGB channel to linear light, calculates relative luminance, then uses the WCAG contrast formula: (lighter luminance + 0.05) / (darker luminance + 0.05). The examples on the page are there so you can compare your inputs with a filled-out example before copying the answer.

What do the main Color Contrast Checker inputs mean?

Text color: the foreground hex color for the text, icon, label, or button copy you want people to read. Background color: the exact hex color directly behind that foreground color, not a nearby surface color. Contrast ratio: the lighter relative luminance divided by the darker relative luminance after WCAG adds 0.05 to both sides. AA normal text: passes when the ratio is at least 4.5:1 for typical body text. AA large text: passes when the ratio is at least 3:1 for large or bold text that meets the WCAG large-text size rule.

How should I read the Color Contrast Checker answer?

Read the headline answer, then check the supporting lines and examples to understand how the calculator got there. If one input changes, rerun the tool and compare the new answer instead of guessing.

What should I double-check before trusting the answer?

Contrast ratio is one accessibility check. Also review actual font size and weight, focus states, hover states, selected states, icons, disabled controls, color-blind cues, and the real page background. Also check the actual font size, font weight, state, theme, and page background because a color pair can pass in one component and fail in another.

What contrast ratio do I need for WCAG AA?

For most normal text, WCAG AA needs at least 4.5:1. Large text can pass AA at 3:1. If the result is close to the line, test the real font size, weight, and state before approving the color pair.

What contrast ratio do I need for WCAG AAA?

WCAG AAA is stricter: 7:1 for normal text and 4.5:1 for large text. AAA can be hard to meet with some brand palettes, so use it as a stronger readability target when the design can support it.

Why does #777777 on white fail normal AA text?

#777777 on #ffffff is about 4.4780894536:1. That is very close, but it is still below the 4.5:1 AA normal-text threshold, so the checker marks normal text as fail while large text can pass.

Does a passing contrast ratio make the design accessible?

No. A passing ratio is important, but it does not check font size, line height, focus outlines, hover states, disabled controls, icons without text, color-only meaning, or whether the color sits on a gradient or image.

Should I test hover, focus, selected, and disabled states separately?

Yes. A button, tab, link, or form field can change text color, border color, background color, or outline color in each state. Test the exact colors for the real state people will see, especially focus and selected states.

Can I use this for icons, borders, and focus outlines?

You can use the ratio as a quick check, but decide whether the element is text, non-text UI, or decorative. Meaningful icons, focus outlines, and control borders often need their own contrast check against the adjacent color.

Does the site save what I enter?

No. The tool runs in your browser tab. Your recent answers stay only on the page while you use it, and they are not sent to a server.

Related tools