WCAG Color Contrast Guide: AA and AAA Compliance

A detailed guide to WCAG color contrast requirements, explaining the differences between AA and AAA compliance levels, how contrast ratios are calculated, and practical tools for ensuring your designs meet accessibility standards.

What Are WCAG Contrast Ratios?

WCAG (Web Content Accessibility Guidelines) defines contrast ratios as a measure of the difference in perceived luminance between two colors. The ratio ranges from 1:1 (no contrast, identical colors) to 21:1 (maximum contrast, black on white). These ratios are calculated using the relative luminance of the foreground and background colors. The formula accounts for how the human eye perceives brightness differently across the color spectrum, giving more weight to green and less to blue. Meeting the specified contrast ratios ensures that text and UI elements are readable for users with low vision or color vision deficiency.

AA vs AAA Compliance Levels

WCAG defines two conformance levels for contrast: AA and AAA. Level AA requires a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (18pt / 24px regular, or 14pt / 18.66px bold). Level AAA raises these requirements to 7:1 for normal text and 4.5:1 for large text. Most organizations target AA compliance as a practical minimum, while AAA is recommended for content that serves users with significant visual impairments. Achieving AAA across an entire site can be challenging, but aiming for it in key content areas like body text and navigation significantly improves usability.

Large Text Rules and Exceptions

WCAG provides relaxed contrast requirements for large text because larger characters are inherently easier to read. Text qualifies as large if it is at least 18 points (24px) at regular weight or 14 points (18.66px) at bold weight. Large text needs only a 3:1 ratio for AA compliance and 4.5:1 for AAA. This distinction allows designers more flexibility with headings and display text while maintaining strict standards for body copy. Note that these thresholds apply to rendered size, not the CSS font-size value alone, so browser zoom and responsive scaling should be considered.

How to Calculate Contrast Ratios

The contrast ratio formula is (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 is the relative luminance of the darker color. Relative luminance is calculated by converting sRGB values to linear RGB and then applying the formula: L = 0.2126 * R + 0.7152 * G + 0.0722 * B. While you rarely need to calculate this by hand, understanding the formula helps explain why certain color combinations fail. For instance, yellow on white has a very low contrast ratio despite appearing bright, because both colors have high luminance values.

Non-Text Contrast Requirements

WCAG 2.1 introduced Success Criterion 1.4.11 (Non-text Contrast), which requires a 3:1 contrast ratio for user interface components and graphical objects. This applies to form field borders, icons that convey meaning, chart elements, focus indicators, and custom controls. A common failure is using light gray borders on white input fields, which can be invisible to users with low vision. Focus indicators must also meet this threshold, meaning the default browser outline should not be removed without providing an equally visible alternative.

Common Contrast Failures and How to Fix Them

The most frequent contrast failures include light gray text on white backgrounds, placeholder text with insufficient contrast, and colored text on colored backgrounds where both have similar luminance. Thin fonts exacerbate low contrast because less surface area is visible. To fix these issues, darken text colors, increase font weight, add backgrounds or borders to improve separation, and avoid relying on subtle color differences. Run automated checks with tools like axe or Lighthouse, but also perform manual review since automated tools cannot evaluate every context in which colors appear.

Tools for Checking Contrast

Several free tools make contrast checking straightforward. The WebAIM Contrast Checker allows you to input any two hex colors and instantly see the contrast ratio with pass/fail indicators for AA and AAA. Chrome DevTools displays contrast ratios in the color picker and flags insufficient contrast in the Accessibility panel. Figma plugins like Stark and A11y - Color Contrast Checker integrate directly into design workflows. For bulk checking across an entire page, browser extensions like axe DevTools and WAVE scan for contrast violations automatically and generate detailed reports.

Integrating Contrast Checks into Your Workflow

The most effective way to maintain contrast compliance is to build checks into your existing workflow at multiple stages. Define your design system colors with contrast ratios documented for every text-background combination. Use linting tools like eslint-plugin-jsx-a11y in development to catch issues at build time. Add automated accessibility testing with axe-core or pa11y in your CI/CD pipeline to prevent regressions. Schedule periodic manual audits to catch issues that automated tools miss, such as dynamically generated color combinations or images with text overlays.

Tips

  • Bookmark the WebAIM Contrast Checker (webaim.org/resources/contrastchecker) and use it as your go-to reference when selecting colors.
  • When in doubt, aim for AAA contrast ratios (7:1) for body text. It provides a comfortable margin and ensures readability in varied lighting conditions.
  • Test contrast on multiple monitors and devices, as display calibration and ambient lighting significantly affect perceived contrast.
  • Use CSS custom properties for your color palette so you can adjust contrast globally from a single source of truth.
  • Do not disable or override browser default focus indicators unless you replace them with an equally visible custom style that meets the 3:1 non-text contrast requirement.

Frequently Asked Questions

Does contrast ratio apply to images with text?

Yes. If text is rendered over an image, the contrast between the text and the area of the image directly behind it must meet WCAG requirements. This can be difficult with photographs that vary in brightness. Common solutions include adding a semi-transparent overlay behind the text, using a solid background box, or applying a text shadow. Logos and decorative text that does not convey essential information are exempt from contrast requirements under WCAG, but all informational text must comply.

My brand colors do not meet the 4.5:1 contrast ratio. What should I do?

You have several options. First, use your brand colors for large headings or decorative elements where the 3:1 large text ratio applies, and use a higher-contrast color for body text. Second, create a slightly darker or lighter variant of your brand color specifically for text use. Third, ensure sufficient contrast by adjusting the background color rather than the text. Many brands maintain visual identity while meeting accessibility standards by reserving low-contrast brand colors for non-text elements like backgrounds, borders, and illustrations.

Are there any exceptions to the contrast requirements?

WCAG provides exceptions for several cases. Incidental text that is part of an inactive UI component, purely decorative text, or text that is not visible to anyone is exempt. Logotypes (text that is part of a logo or brand name) have no contrast requirement. Text in photographs is also exempt if the image itself is the content. However, if that text conveys essential information not available elsewhere, it should meet contrast standards. Disabled form controls are technically exempt, but it is still good practice to ensure they are visible enough for users to understand they exist.