apprun.icuGuides

Guide · Design

Check accessible color contrast for real text and backgrounds

For solid text colors, WCAG AA needs at least 4.5:1 for normal text and 3:1 for large text. Use the actual foreground and background, apply the threshold without rounding up and test other interface states separately.

By apprun.icuUpdated Read 4 minIncludes a working browser tool
On this page
  1. The short answer
  2. Test the color pair that is actually rendered
  3. Choose the right text threshold
  4. Do not turn a near miss into a pass
  5. Account for transparency and images
  6. Inspect controls and interaction states separately
  7. Keep the evidence close to the design
  8. Common questions
  9. Sources and further reading
Foreground luminance → Compare background → Check text thresholdForegroundluminanceCompare backgroundCheck textthreshold
Foreground luminance → Compare background → Check text threshold. Follow the units and the representation at each step.

Test the color pair that is actually rendered

A palette contains individual colors, but text contrast is a relationship between a foreground and its background. A dark blue may work well on white and fail on a dark panel. A brand swatch is not globally accessible or inaccessible without its use context.

Enter two solid sRGB colors in the checker. Short hexadecimal forms such as #fff are expanded to their full form. The tool computes relative luminance, then compares the lighter and darker values with the WCAG contrast formula. Black on white produces 21:1, while identical colors produce 1:1.

Choose the right text threshold

WCAG AA uses 4.5:1 for normal text and 3:1 for large text. AAA uses 7:1 and 4.5:1 respectively. Large text means at least 18 points in ordinary weight or 14 points in bold, approximately 24 CSS pixels or 18.67 CSS pixels.

A heading is not automatically large enough merely because it has an h2 tag or feels prominent. Inspect the actual size and weight. If the design shrinks a heading at a narrow breakpoint, its required threshold can change. Keep the normal-text result visible when evaluating a responsive type scale.

Try it with your own input

Large text sample

Normal text should be comfortable to read.

Your result

Do not turn a near miss into a pass

The threshold applies to the calculated ratio, not to a rounded label. A value just below 4.5 does not pass normal-text AA because a display rounds it to 4.50. Our status checks use the unrounded value even though the ratio is shown with two decimal places.

Leave a reasonable design margin when you can. Antialiasing, thin type and display characteristics can affect perceived legibility even when the specified colors meet the mathematical threshold. Passing a minimum is useful evidence, not a reason to ignore whether real text is comfortable to read.

Account for transparency and images

This checker accepts opaque solid colors. A translucent text or background layer must be composited with the layers behind it before a simple pair comparison describes what appears on screen. A gradient or image can create several different local backgrounds behind one line of text.

Check the least favorable area that can occur in the real layout. Consider a solid backing surface or a controlled overlay when the content background is unpredictable. Re-test when an image changes, when a card moves or when the layout crops a different part of the image on a phone.

Inspect controls and interaction states separately

Text contrast is one check. Buttons, focus indicators, icons that communicate meaning and other visual controls have their own requirements and contexts. A form can have readable labels while its keyboard focus ring disappears against the surrounding panel.

Inspect default, hover, focus, active, error and selected states. Do not use color as the only way to explain an error or distinguish series in a chart. Pair it with text, shape or another meaningful signal. The accessibility page describes the site’s interaction and motion approach without claiming a formal conformance certification.

Keep the evidence close to the design

Record the exact color values, the ratio, the relevant text size and the state tested. Use the Palette tool to explore a coordinated set, then check the actual pairs used in the interface. A palette-wide score can hide a failing combination.

Finally, test keyboard operation, zoom, narrow layouts and content structure. The image-shape guide covers responsive cropping, while the Markdown guide covers meaningful headings and links. A color checker contributes one measurable part of a broader usable page.

Common questions

What ratio does normal text need for AA?

At least 4.5:1 under the WCAG text contrast calculation.

What counts as large text?

At least 18 pt regular or 14 pt bold, approximately 24 or 18.67 CSS pixels.

Can a rounded 4.50 ratio still fail?

Yes. The unrounded value may be below 4.5. The tool uses the unrounded value for its pass status.

Does this handle gradients or transparent colors?

No. Check the actual composited colors and the least favorable background in the real interface.

Does a passing pair certify my website?

No. Keyboard access, structure, states, non-text contrast and other accessibility requirements need separate checks.

Sources and further reading

Share this guide