Color Contrast Requirements

Color contrast is one of the most measurable and frequently violated aspects of web accessibility. Insufficient contrast makes text difficult or impossible to read for people with low vision, color blindness, or anyone using a screen in bright sunlight. WCAG provides specific, testable contrast ratio thresholds that every website must meet. The good news is that contrast issues are among the easiest accessibility problems to detect and fix.

WCAG Contrast Ratios

WCAG defines contrast requirements through two success criteria, one at Level AA and one at Level AAA:

WCAG 1.4.3 Contrast (Minimum) — Level AA

This is the standard requirement that most organizations need to meet:

  • Normal text: Minimum contrast ratio of 4.5:1 against the background
  • Large text: Minimum contrast ratio of 3:1 against the background
  • Incidental text: Text in inactive UI components, purely decorative text, and text that is not visible to anyone has no contrast requirement
  • Logotypes: Text that is part of a logo or brand name has no minimum contrast requirement

WCAG 1.4.6 Contrast (Enhanced) — Level AAA

This is the enhanced requirement for the highest level of accessibility:

  • Normal text: Minimum contrast ratio of 7:1
  • Large text: Minimum contrast ratio of 4.5:1

WCAG 1.4.11 Non-text Contrast — Level AA

Added in WCAG 2.1, this criterion extends contrast requirements beyond text:

  • UI components: Visual information needed to identify user interface components and states must have a contrast ratio of at least 3:1 against adjacent colors. This includes form field borders, button outlines, focus indicators, and custom checkboxes.
  • Graphical objects: Parts of graphics required to understand the content must have a contrast ratio of at least 3:1. This applies to chart lines, icon shapes, and infographic elements.
What is a contrast ratio? A contrast ratio is a mathematical comparison of the relative luminance of two colors, expressed as a ratio from 1:1 (no contrast, same color) to 21:1 (maximum contrast, black on white). The formula accounts for how the human eye perceives brightness across different colors.

What Counts as "Large Text"

WCAG defines large text as:

  • 18 point (24px) or larger at normal weight
  • 14 point (18.66px) or larger at bold weight (700 or above)

Large text gets a more relaxed contrast threshold (3:1 at AA instead of 4.5:1) because larger characters are inherently easier to read at lower contrast levels. The visual acuity required to distinguish characters decreases as text size increases.

Watch out: The point-to-pixel conversion is not always straightforward. A "point" in WCAG is defined as 1/72 of an inch, which at 96 DPI equals approximately 1.333 CSS pixels per point. So 18pt equals 24px, and 14pt equals approximately 18.66px. Always measure in CSS pixels to be precise.

Contrast Checking Tools

Several excellent tools are available for checking color contrast:

WebAIM Contrast Checker

The WebAIM Contrast Checker is a free online tool where you enter foreground and background colors and instantly see whether they pass WCAG AA and AAA thresholds for both normal and large text. It also provides a visual preview and suggests nearby colors that would pass.

Chrome DevTools

Chrome's built-in DevTools includes contrast checking directly in the color picker:

  1. Right-click on any text element and select "Inspect"
  2. Click on the color swatch next to the color property in the Styles panel
  3. The color picker shows the current contrast ratio and whether it passes AA and AAA
  4. Two curved lines in the color picker indicate the AA and AAA boundaries — any color above the line passes

CodeFrog's Automated Checks

CodeFrog uses axe-core to automatically detect color contrast failures across every page it crawls on your localhost. Because axe-core automated checks only detect a subset of WCAG issues, any WCAG A/AA rating that CodeFrog reports reflects automated coverage only. In real-world audits, automated testing typically finds approximately 30% of all accessibility issues. Full WCAG conformance requires manual testing with assistive technologies such as screen readers and keyboard-only navigation. That said, CodeFrog catches contrast issues as part of a comprehensive automated accessibility audit without requiring you to manually check each element. CodeFrog reports the specific elements that fail, the actual contrast ratio, and the required minimum.

Other Tools

  • Colour Contrast Analyser (CCA) — A free desktop application from TPGi that includes an eyedropper tool for sampling colors directly from your screen. Available for Windows and macOS.
  • Stark — A design plugin for Figma, Sketch, and Adobe XD that checks contrast during the design phase, before any code is written.
  • axe DevTools browser extension — Flags contrast issues alongside other accessibility violations directly in the browser.
  • WAVE browser extension — Highlights contrast errors with visual icons on the page.
Best practice: Check contrast during design, not just during testing. Tools like Stark for Figma catch issues before developers write a single line of code. Fixing contrast in a design tool takes seconds; fixing it in production code and redeploying takes much longer.

Common Contrast Failures

Certain contrast failures appear repeatedly across websites. Here are the most common ones and how to recognize them:

Light Gray Text on White Backgrounds

This is the single most common contrast failure on the web. Designers sometimes use light gray text (like #999999 on #ffffff) for secondary content, captions, or timestamps. The resulting contrast ratio of 2.85:1 fails both AA and AAA.

  • Fix: Use at least #767676 on white for 4.5:1 contrast, or #595959 for 7:1 (AAA)

Low-Contrast Placeholder Text

Form input placeholder text (the gray hint text inside empty fields) is notoriously low-contrast. Browser default placeholder styles often fail WCAG requirements. Since placeholder text serves as a label or instruction, it must be readable.

  • Fix: Style placeholders to meet 4.5:1 contrast: ::placeholder { color: #767676; }
  • Better fix: Do not rely on placeholders as the only label. Use visible <label> elements and treat placeholders as supplementary hints.

Text Over Images Without Overlay

Text placed directly over photographs or background images frequently fails contrast because the underlying image varies in brightness. One area of the image may provide good contrast while another does not.

  • Fix (overlay): Add a semi-transparent dark overlay between the image and text: background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6))
  • Fix (text shadow): Add a strong text shadow: text-shadow: 0 2px 4px rgba(0,0,0,0.8)
  • Fix (background box): Place text in a solid or semi-transparent colored box over the image
  • Best fix: Test the specific combination with a contrast checker to ensure it meets the ratio

Colored Buttons with White Text

Bright blue, green, orange, and red buttons with white text frequently fail contrast. For example, Bootstrap's default .btn-warning (orange button with white text) fails AA contrast requirements.

  • Fix: Use darker button colors or darker text on light buttons. For example, use dark text on yellow/orange buttons instead of white.

Focus Indicators

Custom focus outlines that are too subtle can fail WCAG 1.4.11 (Non-text Contrast). A light blue focus ring on a white background may have insufficient contrast.

  • Fix: Ensure focus indicators have at least 3:1 contrast against the surrounding background. A 2px solid outline in a dark color usually works well.

Disabled State Styling

WCAG does not require contrast on disabled (inactive) UI components. However, users still need to be able to perceive that the element exists and is disabled. Many designers make disabled elements so low-contrast that users cannot tell they exist at all.

  • Recommendation: While not required by WCAG, keep disabled elements at least somewhat visible (around 3:1 contrast) so users understand the interface state.

How to Fix Contrast Issues While Maintaining Brand Aesthetics

A common concern is that meeting contrast requirements will make a website look ugly or conflict with brand colors. In practice, accessibility and good design are complementary:

  1. Adjust lightness, not hue. You can keep your brand colors while making them darker or lighter to achieve the required contrast. A brand blue of #3498db that fails on white can be darkened to #2874a6 and still look like the same blue.
  2. Use your brand colors for large text and accents. Large text only needs 3:1 contrast, so your brand colors may already pass at larger sizes. Use the exact brand color for headings and a slightly adjusted version for body text.
  3. Create an accessible color palette. During the design system phase, define each color with its accessible pairings. For every background color, document which text colors pass AA and AAA.
  4. Use contrast as a design constraint, not an afterthought. When designers know the constraints from the start, they design within them naturally. Retrofitting contrast fixes is harder than designing with contrast in mind.
  5. Test early in the design process. Tools like Stark (Figma plugin) let designers check contrast as they work, preventing issues from ever reaching code.
Practical rule of thumb: If you squint at your page and cannot read the text, it probably fails contrast. Good contrast is not just an accessibility requirement — it is good design that benefits all users, including those on old monitors, in bright environments, or with aging eyes.

Color Beyond Contrast: Color as the Sole Indicator

WCAG 1.4.1 (Use of Color, Level A) requires that color is not used as the only visual means of conveying information. This is separate from contrast but equally important:

  • Form errors: Do not use only a red border to indicate an error. Add an error icon and error text as well.
  • Links: If links in body text are distinguished only by color (no underline), they must have at least 3:1 contrast against surrounding text AND another visual indicator on hover/focus (like an underline).
  • Charts and graphs: Do not rely only on color to distinguish data series. Use patterns, labels, or different shapes in addition to color.
  • Status indicators: A green/red status dot should also include text ("Active" / "Inactive") or an icon.

Testing Contrast Systematically

For comprehensive contrast testing, follow this approach:

  1. Run an automated scan first (CodeFrog, axe-core, or Lighthouse) to catch all programmatically detectable contrast failures
  2. Check text over images and gradients manually — automated tools often cannot calculate contrast against non-solid backgrounds
  3. Check interactive states — hover, focus, active, disabled, and selected states all need their own contrast evaluation
  4. Check non-text elements — form field borders, icons, chart elements, and focus indicators (WCAG 1.4.11)
  5. Test in different lighting conditions — view your site on a screen in direct sunlight to see how contrast holds up in real-world conditions

Resources