Color Contrast

Check the WCAG contrast ratio of two colors, including AA and AAA for normal and large text.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

Relative luminance comes from the sRGB channels after the WCAG linearization. The contrast ratio is (lighter + 0.05) / (darker + 0.05).

The guide on how contrast is calculated walks through that formula. This page applies it to the two colors you enter.

How to use it

  1. Enter the two colors.
  2. Check contrast.
  3. Read the ratio and the AA and AAA rows for normal and large text.

Limitations

WCAG ratio, with the pass cut on the unrounded value

The ratio the checker computes

Each color is parsed as hex and turned into relative luminance with the sRGB transfer, not by averaging the three channels. A channel at or below 0.04045, after dividing by 255, is divided by 12.92. A brighter channel uses ((channel + 0.055) / 1.055) raised to 2.4. Luminance is 0.2126 times linearized red, plus 0.7152 times linearized green, plus 0.0722 times linearized blue. The contrast ratio is the lighter luminance plus 0.05, divided by the darker luminance plus 0.05. Order of the two fields does not matter, because lighter and darker are chosen after both luminances exist. The same color in both fields yields 1. Black against white yields 21.

The printed ratio has two decimal places. Pass and fail compare the unrounded ratio with the thresholds. Normal text needs 4.5 for AA and 7 for AAA. Large text needs 3 for AA and 4.5 for AAA. A value that rounds to 4.50 on screen can still fail AA if the full ratio is just under 4.5. Trust the pass word when the two disagree. The sample sentence and the large-text sample are only a preview. The page does not know your font, your point size, or your weight, so it always prints both rows. Large text, in the WCAG sense used by the companion note, means at least 18 point, or 14 point bold.

What a pass leaves out

A passing pair is not a full accessibility review. Focus rings, text inside images, and a photograph behind translucent ink are not measured. The colors are treated as opaque sRGB. Display calibration and room lighting are not modeled. Printer ink on paper is not modeled either. If you need the luminance of one color alone, use the luminance page. This page always needs two colors.

The steps above are the same ones written up at How contrast is calculated. That note is the short statement of the formula. This page is where the two hex values are applied and the four pass lines are filled in. Non-text UI components that WCAG scores at 3:1 are not a separate row here. Compare the printed ratio with 3 yourself if that is the criterion you were given.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.