Color Contrast Checker

Pick or paste two hex colors, calculate their contrast ratio, see WCAG 2.2 AA and AAA results, and get a nearby AA text-color suggestion when normal text fails.

Illustration for Color Contrast Checker showing check WCAG 2.2 contrast and find a nearby AA-passing text color.
Color Contrast Checker artwork matches the live tool workflow: check WCAG 2.2 contrast and find a nearby AA-passing text color. Use it with the calculator, examples, and result notes.View in the smoke-kawaii gallery
Inputs explainedResult checksExample valuesRuns 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

This pair clears WCAG 2.2 AA for normal text. Also check focus, hover, disabled, and meaningful non-text 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).

Examples

Recent answers

Recent contrast checks will appear here.

Color contrast checks run locally and use WCAG contrast math for quick design accessibility checks.

Inputs and recent answers stay in this browser tab and are not sent to a server.

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.

Repair a near-miss text color without guessing at random hex values.

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, with #767676 suggested for AA normal text

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). When normal text fails AA, it also samples small RGB moves toward black and white and returns the shortest passing foreground change. 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: pick a swatch or paste the foreground hex color for the text, icon, label, or button copy you want people to read. Background color: pick or paste 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. The suggested color changes only the foreground and is not a W3C-approved palette choice. Also review actual font size and weight, focus states, selected states, meaningful icons, color-only 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.

How is the nearby AA text color chosen?

The calculation keeps the background fixed and samples small RGB moves from the entered foreground toward black and white. It returns the passing option with the shortest RGB distance. Treat it as a practical starting point, not a W3C-approved brand 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

CSS Clamp CalculatorGenerate CSS clamp formulas for fluid font sizes, spacing, and responsive layout values.