Skip to main content

Check WCAG 2.1 Color Contrast for Accessible Web Design

Check the contrast ratio between text and background colors against WCAG 2.1 AA and AAA.

Loading tool…

Your file stays in this browser. Nothing is uploaded.

How WCAG Color Contrast Checker works

Browser Toolset WCAG Color Contrast Checker calculates the luminance contrast ratio between foreground text and background colors in your browser. See whether a text and background color pair meets the WCAG 2.1 Level AA and AAA text contrast thresholds. This is not a full accessibility audit. Nothing is sent to a server.

How to use this tool

  1. Select or enter your Text (foreground) color as a HEX code.
  2. Select or enter your Background color as a HEX code.
  3. Review the calculated contrast ratio (e.g., 4.5:1, 7:1, 12:1).
  4. Check the four pass/fail badges: WCAG AA Normal, AA Large, AAA Normal and AAA Large.
  5. If a badge fails, change one of the colors yourself and watch the ratio and badges update.

Common uses

  • UI/UX designers checking text colors against WCAG contrast thresholds.
  • Frontend developers auditing web typography before production deployment.
  • Content writers verifying button text legibility on colored call-to-action banners.
  • Accessibility reviewers spot-checking color pairs during design audits.

Frequently asked questions

What is the minimum contrast ratio required for WCAG AA compliance?

WCAG 2.1 Level AA requires a contrast ratio of at least 4.5:1 for normal body text and at least 3.0:1 for large text (18pt or 14pt bold).

What is the requirement for WCAG Level AAA compliance?

WCAG Level AAA requires a contrast ratio of at least 7:1 for normal text and at least 4.5:1 for large text, meaning 18 pt or larger, or 14 pt bold or larger. The checker shows a pass or fail badge for each.

Are my website color palettes uploaded to external servers?

No. Contrast ratios are calculated in your browser with the WCAG relative luminance formula, and your colors are not uploaded. The tool accepts 3, 4, 6 or 8-digit HEX codes, and any alpha value is ignored.

Does this tool check anything beyond text contrast?

No. It checks the ratio between two solid colors for text, using the WCAG AA and AAA text thresholds. It has no separate badge for UI components or icons, so apply the 3:1 rule for those by reading the ratio yourself.

Can I swap text and background colors with one click?

There is no Swap button. Copy each HEX code into the other field to see the reversed pairing; the ratio is the same either way.

Details and limits

Web accessibility matters, and legal requirements can apply to public websites. Many users experience low vision or color blindness. Our WCAG Color Contrast Checker calculates the contrast ratio from relative luminance and shows whether it meets the WCAG AA and AAA text thresholds. It checks the color pair only, so also review your design in context.

How the contrast ratio is calculated

The calculation runs in your browser and nothing is uploaded or saved. Enter a text color and a background color with the swatches or text boxes. The page opens on #0f172a over #ffffff. Each red, green and blue value is converted to linear light using the WCAG formula, with the 0.03928 threshold, and combined as 0.2126 red plus 0.7152 green plus 0.0722 blue. That gives the relative luminance of each color.

The ratio is the lighter luminance plus 0.05 divided by the darker one plus 0.05, between 1:1 and 21:1. The lighter color is always placed on top, so swapping text and background gives the same figure. A preview card shows a headline and a paragraph in your two colors.

Features and limits

  • Four badges follow the thresholds in the code: AA Normal needs 4.5:1, AA Large 3:1, AAA Normal 7:1 and AAA Large 4.5:1. A green check means the ratio is at or above the threshold.
  • The large number is cut to two decimals, never rounded up, and the badges use the exact ratio. A ratio shown as 4.49 therefore fails AA Normal because the true value is below 4.5, while 4.50 passes.
  • Input must be HEX with 3, 4, 6 or 8 digits, with or without the #. For 4 and 8 digits the alpha part is dropped, so a semi-transparent color is treated as opaque. rgb(), hsl() and color names are not accepted. Use the Color Code Converter to get a HEX value.
  • When either field is invalid the ratio is replaced by a message and all four badges show as failed. In the preview, an invalid text color is drawn as black and an invalid background as white.
  • The tool does not measure your type size. WCAG counts large text as at least 18 point, or 14 point bold. There are no fix suggestions, no badge for icons and borders, and no APCA scoring.

Tips and common problems

The tool compares two flat colors. For text over a gradient or photo, test the worst spot, usually where the background is closest to the text color.

A passing ratio covers the color requirement only. Font size, weight, spacing and other WCAG rules still apply, so treat the result as a check and not a certification.

WCAG 2.1 also asks for at least 3:1 on interface parts such as icons and input borders. The badges here do not test that, but you can compare the ratio with 3 yourself.

To fix a failing pair, darken the text or lighten the background in small steps, using the Color Picker & Palette Inspector to try new shades.