Developer tools

Color Contrast Checker

Check an opaque foreground and background color against WCAG 2.2 text and UI contrast thresholds. Preview the pair, find lightness-only passing suggestions, and copy CSS or a share link.

successful runs
upvotes
comments

Use three- or six-digit opaque hex colors, such as #123 or #1F2937.

Contrast ratio

14.68:1

AA normal text (4.5:1)

Pass

AAA normal text (7:1)

Pass

AA large text (3:1)

Pass

AAA large text (4.5:1)

Pass

AA UI and graphics (3:1)

Pass

Normal text preview at 16 CSS pixels.

Large bold text preview at 24 CSS pixels.

UI boundary preview

A passing pair covers only this opaque sRGB comparison. It is not a complete WCAG audit of typography, states, images, gradients, transparency, or color-only meaning.

Hex colors, contrast calculations, previews, and suggestions stay in your browser. The site may still send one anonymous tool-use total after you change a valid setting.

How to Use the Color Contrast Checker

  1. Enter the foreground text or icon color and its background as three- or six-digit hex values.
  2. Review the exact ratio and the five WCAG 2.2 pass or fail results.
  3. Compare the normal-text, large-text, and UI boundary previews.
  4. If the selected target fails, try the nearest foreground or background lightness suggestion.
  5. Copy the result, CSS declarations, or a stable share link; use Swap or Reset for another pair.

WCAG 2.2 Contrast Formula and Thresholds

Each opaque 8-bit sRGB channel is divided by 255 and converted from encoded sRGB to linear light. WCAG uses the 0.04045 breakpoint, then combines the channels as 0.2126 red + 0.7152 green + 0.0722 blue. The final ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05). Ratios range from 1:1 for identical luminance to 21:1 for black and white.

WCAG 2.2 Level AA requires 4.5:1 for ordinary text and 3:1 for large-scale text. Level AAA requires 7:1 for ordinary text and 4.5:1 for large-scale text. Visual information needed to identify active user-interface components and meaningful graphics has a 3:1 Level AA threshold against adjacent colors.

Color Contrast Examples

Black on white

#000000 on #FFFFFF has the maximum 21:1 ratio. It passes the text and non-text thresholds reported here.

The normal-text AA boundary

#767676 on #FFFFFF is about 4.54:1. It passes AA normal text and AAA large text, but it does not reach the 7:1 AAA normal-text threshold.

A pair that passes large text but not normal text

#777777 on #FFFFFF is about 4.48:1. It passes the 3:1 large-text and UI threshold but narrowly misses 4.5:1 for AA normal text. This is why the unrounded ratio, not visual guesswork, determines the result.

How Lightness Suggestions Work

For each failing pair, the checker holds the adjusted color's HSL hue and saturation constant, searches lightness in 0.1-percentage-point steps, and returns the nearest candidate that reaches the selected ratio. One suggestion changes the foreground while the background stays fixed; the other changes only the background. If black or white at that hue/saturation endpoint still cannot reach a 7:1 target against the fixed color, the tool explains that lightness alone is insufficient.

Limits of a Two-Color Contrast Check

The first release accepts opaque sRGB hex colors only. It does not composite alpha, sample gradients or images, evaluate wide-gamut colors, inspect font size or weight, account for anti-aliasing and display conditions, or test every component state and adjacent color. Use the preview as a review aid rather than evidence of full WCAG conformance.

Contrast also does not replace labels, keyboard access, focus indicators, non-color cues, logical structure, or user testing. A page can use a passing pair and still have serious accessibility barriers.

Community discussion

Comments

Share feedback about the tool. Don’t include private calculation inputs or account details.

0
Loading discussion…

Method, sources, and review

Built and maintained by
TheToolSite AutomationAutomation
Method reviewed by
Derrick Frye
Last reviewed
August 19, 2026
Publisher
TheToolSite

Methodology

Converts opaque sRGB hex colors to relative luminance with the WCAG 2.2 transfer function, computes (lighter + 0.05) / (darker + 0.05), and compares the ratio with 3:1, 4.5:1, and 7:1 thresholds.

Assumptions

Limitations

A passing color pair is not a complete accessibility audit. The tool does not model alpha compositing, images, gradients, font rendering, state changes, or all WCAG requirements.

Rounding and precision

Ratios are displayed to two decimals while pass/fail comparisons use the unrounded ratio. Suggestions search HSL lightness in 0.1-percentage-point steps.

Sources

Report a problem with this result or source

Color Contrast Checker FAQ

What contrast ratio does WCAG 2.2 require for normal text?

Level AA requires at least 4.5:1 for ordinary text. Level AAA requires at least 7:1, subject to the specification's exceptions.

What counts as large text for the 3:1 threshold?

WCAG large-scale text is at least 18 point regular or 14 point bold, commonly about 24 CSS pixels regular or 18.66 CSS pixels bold. Confirm the actual size and weight in the final design.

Do icons and form controls need color contrast?

Visual information needed to identify active controls, states, and meaningful graphics generally needs at least 3:1 against adjacent colors under WCAG 2.2 Success Criterion 1.4.11, with stated exceptions.

Why can a displayed 4.50:1 result still fail?

The page displays two decimals for readability but evaluates the unrounded ratio. A value slightly below 4.5 can display as 4.50 after rounding and still fail the exact threshold.

How are the suggested colors chosen?

The checker keeps one color fixed and preserves the other color's HSL hue and saturation while searching lightness in 0.1-percentage-point steps for the nearest candidate that reaches the selected target.

Does a passing result mean my page is WCAG compliant?

No. It covers one opaque sRGB pair only. Full conformance also depends on typography, states, adjacent colors, transparency, images, keyboard access, labels, focus, structure, non-color cues, and the rest of the applicable requirements.

Related Developer and Text Tools