UtilityPilot.Find a tool

Web & Publishing

Color Contrast Checker

Check the text contrast between two opaque colors. See the actual ratio and AA/AAA text thresholds, with a preview of your chosen size and weight.

Processed in your browserPrivacy details ↗

1 MiB per input

Pick a color to set its input, or paste HEX, RGB or HSL above. Run the check after changing colors.

Adjust your options

No sign-up. No upload.

How to use this tool

  1. Enter foreground and background colors.
  2. Set text size in pixels and whether it is bold.
  3. Check the ratio and read the normal/large text results.

How the operation works

sRGB channels are linearized before relative luminance is calculated. The ratio is (lighter luminance + 0.05) / (darker luminance + 0.05). Threshold comparisons use the unrounded ratio. AA normal text requires 4.5:1; large text requires 3:1. Large means at least 24 CSS pixels, or approximately 18.67 pixels when bold.

Choose foreground and background colors

Paste an opaque HEX, RGB or HSL value into each labeled input, or use the foreground and background color pickers. Picking a color writes its HEX value into the corresponding input. Swap colors exchanges the two text values; run the check again to update the preview. Unsupported or transparent values remain errors instead of being silently composited against a guessed background.

Select the actual text size in CSS pixels and whether it is bold. The preview uses those choices, but its sentence is only an illustration. Test the colors that your page actually renders, including hover, focus and disabled states where applicable. Color Converter can translate supported HEX/RGB/HSL notation.

Reading WCAG AA and AAA results

For normal text, AA requires at least 4.5:1 and AAA requires at least 7:1. For large text, AA requires 3:1 and AAA requires 4.5:1. Large text here means at least 24 CSS pixels, or at least 18.6667 CSS pixels when bold. The results show all four outcomes, plus AA for your selected size and weight.

A ratio is shown to two decimal places, but Pass or Fail uses the unrounded calculation. A value slightly below 4.5 can display as 4.50 while still failing AA normal text. Do not round a failing result up to a threshold. These are WCAG 2.x text-contrast calculations, not APCA scores.

How the contrast ratio is calculated

Each sRGB channel is linearized, then red, green and blue contribute to relative luminance with weights 0.2126, 0.7152 and 0.0722. The ratio is the lighter luminance plus 0.05 divided by the darker luminance plus 0.05. Comparing raw RGB distances would not produce the same result.

Black #000000 on white #ffffff → 21.00:1
White #ffffff on white #ffffff → 1.00:1

Black on white passes all four text thresholds. Equal colors fail them. Swapping the colors preserves the mathematical ratio, but reverses their roles in the preview. The method and text-size distinctions follow W3C’s contrast guidance.

What a color-pair result does not establish

A passing pair does not establish accessibility compliance for a whole page. Keyboard access, labels, heading structure, focus visibility, content and other requirements need separate review. The tool does not inspect a live website, a background photograph, gradients or transparency layers. Use the actual composited opaque colors when those effects are involved.

For an image background, sample a relevant image color, then consider whether the entire text area has enough contrast. One sampled pixel cannot represent every point in a varying photograph. Avoid relying on color alone to identify an error or status even when the pair passes.

A worked example

#000000 on #ffffff

21:1 contrast. Identical foreground and background colors have 1:1 contrast.

A passing color pair does not certify an entire page. Gradients, background images, disabled controls and other accessibility requirements need separate evaluation. Transparent colors must first be composited.

Processing and privacy

Colour Contrast Checker computes the ratio locally; the foreground and background values are not uploaded. Input stays in browser memory until you reset or leave the page. Copy and download run only when you choose them. No tool input is sent to a processing service. Website pages and scripts still make ordinary hosting requests; the privacy policy separates those from tool processing.

Frequently asked questions

Can a displayed 4.50 fail AA?

Yes. A ratio just under 4.5 can round to 4.50. The pass/fail result uses the full calculated value.

Does passing AA mean the page is accessible?

No. Keyboard access, labels, focus and other requirements need separate review.

What about gradients and images behind text?

Composite the actual colours behind the text first; one pair cannot represent a varying background.

Is this APCA?

No. Results are WCAG 2.x relative-luminance ratios, not APCA scores.

Why can 4.50 still fail?

Display rounds to two decimals; Pass/Fail uses the unrounded calculation.

How this tool was checked

Color Contrast Checker was checked at the exact 4.5:1 and 3:1 boundaries, large and bold text thresholds, fractional channels, identical colours and transparent inputs that need compositing. See the testing method or report a failure.