Skip to main content

developer tool

Color Contrast Checker

Check foreground and background color contrast with the WCAG 2.x sRGB formula. Preview normal and large text, compare AA/AAA thresholds, and copy normalized HEX colors.

Loading tool…

Guide

Color Contrast Checker online

Compare a text color with a solid background before using the pair in an interface. Enter opaque HEX colors or use the native color controls to see the WCAG 2.x contrast ratio, live text previews and four separate AA/AAA text results. Calculations use full precision for pass/fail; only the displayed ratio is rounded. This checks one part of accessibility, not the conformance of an entire website.

How to Check Color Contrast

1

Set the text and background colors

Enter a three- or six-digit opaque HEX value, with or without #, or use a native color control. Valid values normalize to uppercase six-digit HEX. Alpha values and CSS color functions are not supported.

2

Review the ratio and text results

Compare AA and AAA results for normal and large text. Preview the same valid pair at 16px regular and 24px regular, and read the applicable threshold beside each Pass or Fail label.

3

Adjust, swap or copy

Swap the roles, change either color or reset the defaults. If AA normal text fails, review a verified foreground suggestion while keeping the background unchanged. Copy either normalized HEX value when ready.

What a Contrast Ratio Means

A contrast ratio compares the relative luminance of a lighter and darker color. Identical colors produce 1:1, while opaque black and white produce 21:1. Reversing foreground and background leaves the numerical ratio unchanged, although the way a design feels can differ. The checker displays two decimal places, but a displayed 4.50 can still fail a 4.5:1 requirement if the underlying value is slightly lower.

WCAG AA vs AAA Text Contrast

For the text contrast criteria, AA requires at least 4.5:1 for normal text and 3:1 for large text. AAA requires at least 7:1 for normal text and 4.5:1 for large text. These are inclusive minimums evaluated without rounding. The four cards report these text criteria independently; they do not award an overall AA or AAA conformance level to a page.

Normal Text vs Large Text

Large text generally means at least 18pt regular text or 14pt bold, with equivalent sizing provisions for other scripts such as CJK. In CSS units, those sizes are 24px regular and approximately 18.67px bold. A heading label alone does not make text large: its delivered size and weight matter. The large preview here is explicitly 24px regular, while the paragraph preview is 16px regular.

How WCAG Relative Luminance Is Calculated

The opaque 8-bit sRGB channels are normalized to 0 through 1. Values at or below 0.04045 are divided by 12.92; larger values use ((C + 0.055) / 1.055) raised to 2.4. Linear channels are weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue. The ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05). No intermediate value is rounded before threshold comparison.

Why Accessible Color Choices Matter

Text with insufficient light-dark contrast can be difficult to read, particularly for people with low vision and in challenging viewing conditions. Color names or perceived hue differences are not substitutes for a luminance calculation. Checking candidate colors early can reduce later styling changes, but font design, stroke thickness, spacing, zoom and the surrounding interface still affect reading.

Common Contrast Mistakes in Web Design

Do not round a near-pass up to a passing result, assume every heading qualifies as large text, or judge a pair only by a screenshot. Check actual authored colors and relevant UI states. Button label text uses the applicable text contrast requirement; borders, icons and focus indicators require separate non-text and state/context checks. A text result here does not assess all those elements or their exceptions.

Using the Foreground Suggestion

When the selected pair fails AA normal text, the checker tests a bounded sequence of rounded RGB mixtures toward black and toward white. It verifies candidates against the unchanged background using the same unrounded ratio, then proposes a passing candidate from those paths. You can copy it or apply it explicitly. This deterministic search is not a guarantee of the globally nearest or perceptually closest color, and the suggestion only targets the 4.5:1 AA normal-text minimum.

Limits of This Color Contrast Test

The initial version accepts opaque three- and six-digit HEX sRGB values only. Transparent colors are rejected rather than silently treated as opaque; gradients, image backgrounds, blend modes, HDR and wide-gamut CSS inputs are outside the calculation. Invalid or incomplete entries suppress current results while retaining a labeled last-valid preview. Passing text contrast alone does not prove keyboard usability, semantics, focus behavior, full accessibility or website conformance. Calculations run locally without a processing upload.

Common uses for Color Contrast Checker

  • Checking body text against a solid CSS background
  • Reviewing a color pair chosen from an image palette
  • Comparing regular and large text contrast requirements
  • Testing a button label's text colors alongside separate component-state checks

Why use this developer tool?

  • Use the WCAG 2.x sRGB formula with unrounded threshold decisions.
  • Read AA/AAA normal and large text results separately with explicit Pass/Fail labels.
  • Preview, swap, normalize and copy opaque HEX color pairs locally.
  • Review a verified AA normal-text foreground suggestion without changing the background.

Color Contrast Checker FAQ

What is a color contrast checker?

It compares text and background colors using a luminance-based ratio, then reports whether the pair reaches specific text contrast thresholds.

What is a good contrast ratio?

For WCAG AA text contrast, normal text needs at least 4.5:1 and large text needs at least 3:1. AAA requires 7:1 and 4.5:1 respectively. Other accessibility requirements remain separate.

What is WCAG AA?

AA is a WCAG conformance level covering many success criteria. This tool checks the AA text contrast minimums only; it does not assess all criteria needed for page conformance.

What is WCAG AAA?

AAA is a higher WCAG conformance level with additional or enhanced requirements. For the enhanced text contrast criterion, normal text needs 7:1 and large text needs 4.5:1.

What is the minimum contrast ratio for normal text?

Normal text needs at least 4.5:1 for AA and 7:1 for AAA. The underlying ratio must meet the threshold without rounding up.

What is the contrast requirement for large text?

Large text needs at least 3:1 for AA and 4.5:1 for AAA. Large text generally starts at 18pt regular or 14pt bold, with equivalent-size provisions for other scripts.

How do I check HEX color contrast?

Enter text and background colors using three- or six-digit HEX, optionally omitting #. The checker normalizes valid colors and updates the ratio and text results immediately. Alpha HEX and CSS functions are rejected.

Can I check contrast for buttons?

You can check a button label's foreground and solid background using the appropriate text-size threshold. This does not assess the boundary, icon, focus indicator, disabled state or other component requirements.

Does passing the contrast test mean my website is fully accessible?

No. These results cover one opaque text color pair only. Website accessibility depends on many other criteria, content, interaction states and user needs.

Is the Color Contrast Checker free?

Yes. Live calculations, previews, foreground suggestions and HEX copying are free without signup.

Related Tools