Developer Utilities

Color Contrast Checker

Measure opaque HEX color contrast with WCAG luminance calculations, AA/AAA text results and practical color suggestions.

Browser processing · No account required

Choose colors

3 or 6 hexadecimal digits, with or without #. Opaque sRGB only.

3 or 6 hexadecimal digits, with or without #. Opaque sRGB only.

Example combinations

Large text means at least 18pt regular (24 CSS px), or 14pt bold (about 18.67 CSS px). A passing color pair alone does not make a page WCAG compliant.

Contrast result

17.75:1 Passes AA normal-text contrast

Foreground RGB: 16, 24, 40 · Background RGB: 255, 255, 255. Thresholds use the unrounded ratio.

Sample heading

Normal text at 16px: clear information matters.

Large bold text at 19px

Sample button
Sample UI component boundary
  • AA normal textMinimum 4.5:1Pass
  • AA large textMinimum 3:1Pass
  • AAA normal textMinimum 7:1Pass
  • AAA large textMinimum 4.5:1Pass
  • Non-text UI (where applicable)Minimum 3:1Pass

Non-text guidance concerns meaningful UI states/boundaries against adjacent colors; text inside controls still needs the applicable text ratio. This evaluates two solid colors only, without alpha, gradients, images or all focus/hover states.

WORK WITH CONFIDENCE

Understand your results

For developers and designers checking the contrast of a solid text/UI color pair before applying it to a design.

Opaque sRGB HEX values are converted to channels, normalized to 0–1 and linearized with the WCAG transfer function. Relative luminance is 0.2126R + 0.7152G + 0.0722B. The ratio is (lighter luminance + 0.05) / (darker luminance + 0.05). Checks use the full ratio before display rounding, so a rounded value alone cannot decide a boundary pass.

How to use this tool

  1. Enter three- or six-digit foreground/background HEX values, use the custom RGB pickers, or choose a preset.
  2. Review the ratio and separate AA/AAA normal/large-text results. Swap colors to inspect the reversed combination.
  3. Try a suggested foreground where available, then evaluate real typography, states and adjacent colors in the actual interface.

What the observations mean

The ratio ranges from 1:1 for identical colors to 21:1 for black/white. WCAG AA and AAA apply different text thresholds; non-text guidance evaluates meaningful visual information against its adjacent colors. Display rounding never changes the pass/fail calculation.

Worked example

Start with the highest-contrast opaque pair and compare the reversed colors.

Foreground: #000
Background: #FFFFFF
Ratio: 21.00:1

Three-digit #000 expands to #000000. Both black-on-white and white-on-black have a 21:1 ratio and pass the listed numeric thresholds; identical colors have 1:1 and fail. This says nothing about the rest of a page's accessibility.

Limits and processing

Opaque sRGB HEX only. No alpha blending, background images, gradients, font detection or full accessibility certification. Suggestions adjust one foreground by a tested black/white blend and do not establish non-text applicability for every component.

Common problems and practical fixes

HEX input is rejected
Enter exactly three or six hexadecimal digits, with an optional #. Remove alpha components or unsupported CSS names.
A displayed ratio seems to meet a boundary but fails
The actual ratio can be just below the threshold and round upward for display. Criteria use the unrounded value.
A passing pair is hard to read in the design
Check font size/weight, actual background, anti-aliasing, user states and context. A two-color computation is one part of accessibility review.

Best practices

Test representative real content and UI states, preserve clear focus indicators and avoid relying on color alone to convey status. Use the official WCAG guidance linked in the supporting guide.

Practical tips

  • Large text means at least 18pt regular or 14pt bold, approximately 24px or 18.67px in CSS.
  • AA normal text requires 4.5:1; large text requires 3:1. AAA uses 7:1 and 4.5:1 respectively.
  • The non-text 3:1 guidance concerns meaningful UI graphics/states against adjacent colors, with exceptions. Text inside a button still has text-contrast requirements.
A LITTLE MORE CLARITY

Frequently asked questions

Practical answers for using the Color Contrast Checker.

Does this certify WCAG compliance?

No. It checks a pair of opaque solid colors. A site also needs evaluation of keyboard access, focus, semantics, text resizing, states, images, gradients and other accessibility requirements.

Are alpha colors or CSS names supported?

This tool accepts opaque three- and six-digit HEX sRGB values. Alpha, named colors, gradients and composited backgrounds are outside this implementation.

How are suggestions chosen?

The tool blends the foreground toward black or white, then selects a nearby tested candidate reaching AA normal-text contrast against the unchanged background. It is one option rather than a uniquely best design.