Color Contrast Ratio
Color contrast ratio is a mathematical measurement of the luminance difference between foreground text and its background color, used by WCAG to ensure text is readable for people with low vision or color vision deficiencies.
In simple terms: Imagine trying to read yellow words on a white page — it is really hard because the colors are too similar. Contrast ratio is a way to measure how different two colors are from each other. The bigger the number, the easier it is to read. The rules say the number has to be at least 4.5 for regular text so everyone can read it comfortably.
What Is Color Contrast Ratio?
Color contrast ratio is a numerical value that represents the difference in perceived brightness (luminance) between two colors, typically a foreground color (like text) and a background color. The ratio ranges from 1:1 (no contrast — both colors are identical) to 21:1 (maximum contrast — pure black on pure white or vice versa). The Web Content Accessibility Guidelines (WCAG) use contrast ratio as the primary metric for determining whether text and UI elements are visually accessible. The formula comes from the W3C's relative luminance calculation, which weights the red, green, and blue components of a color based on how the human visual system perceives them. Green contributes most to perceived brightness, followed by red, then blue. The specific formula is: **contrast ratio = (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 itself is calculated by converting sRGB values to linear values and applying the coefficients: 0.2126 for red, 0.7152 for green, and 0.0722 for blue. In practice, no one calculates this by hand. Tools like the WebAIM Contrast Checker, browser DevTools, and design plugins automate the measurement. What matters is understanding the thresholds and ensuring your designs meet them.
Why It Matters
Approximately 300 million people worldwide have color vision deficiency (color blindness), and over 246 million have moderate to severe distance vision impairment, according to the World Health Organization. Low contrast text is difficult or impossible for these users to read. But poor contrast affects everyone. Older adults naturally experience reduced contrast sensitivity — by age 80, most people need three times more contrast than a 20-year-old. Environmental factors also play a role: screens viewed in bright sunlight, low-quality displays, and dimmed screens all reduce effective contrast. WCAG 2.2 establishes two conformance levels for text contrast. **Level AA** (the standard most laws reference) requires 4.5:1 for normal text and 3:1 for large text. **Level AAA** (enhanced) requires 7:1 for normal text and 4.5:1 for large text. Large text is defined as 18 points (24px) or larger, or 14 points (roughly 18.66px) bold or larger. WCAG 2.2 also introduced Success Criterion 1.4.11 (Non-text Contrast), which requires 3:1 contrast for user interface components and meaningful graphical objects. This means that form field borders, button outlines, icons that convey information, and chart data all need sufficient contrast against their adjacent colors. Failing to meet contrast requirements is one of the most common WCAG violations. The WebAIM Million report, which annually tests the homepages of the top one million websites, consistently finds low contrast text on over 80% of pages tested. It is the single most prevalent accessibility defect on the web.
How It Works
**Understanding the thresholds.** The WCAG contrast ratios map to real-world readability. A 4.5:1 ratio for normal text ensures that people with moderate low vision (roughly 20/40 vision) can read the text without assistive technology. The 3:1 ratio for large text is lower because larger characters are inherently easier to read. The 7:1 AAA ratio provides readability for people with more significant vision loss (roughly 20/80). **Text size and weight matter.** WCAG distinguishes between normal and large text because larger, bolder characters are more legible at lower contrast. When your design uses 18px or larger body text, or 14px bold or larger, you only need 3:1. For anything smaller, you need 4.5:1. **Measuring contrast in practice.** Most workflows involve checking contrast during the design phase (using Figma or Sketch plugins) and again during development (using browser DevTools or automated testing tools). The process is straightforward: 1. Identify the foreground color (text or UI component). 2. Identify the background color directly behind it. 3. Enter both hex values into a contrast checker. 4. Verify the ratio meets the required threshold. **Gradient and image backgrounds.** When text sits on a gradient or photographic background, contrast must be sufficient at the worst-case point — the area where the background is most similar to the text color. Common solutions include adding a semi-transparent overlay behind text or using a text shadow to ensure minimum contrast. **The special case of placeholder text.** Placeholder text in form inputs often uses light gray for visual distinction. But if users rely on placeholders as labels (which is a separate accessibility issue), the placeholder text must meet contrast requirements. Even when placeholders are not the primary label, making them readable improves usability for everyone.
Examples
**Passes AA (4.5:1).** Dark gray text (#333333) on a white background (#FFFFFF) produces a contrast ratio of 12.63:1, well above the 4.5:1 minimum. **Barely passes AA.** A common accessible combination is #767676 on white, which yields exactly 4.54:1. This is the lightest gray that passes AA on a white background, and many design systems use it as their minimum gray. **Fails AA.** Medium gray text (#808080) on white produces 3.95:1, failing the 4.5:1 requirement. Despite looking acceptable to many sighted users, this combination is difficult for people with low vision. **Common failure: brand colors.** A company uses its brand orange (#FF8C00) for body text on a white background. The contrast ratio is 2.94:1 — significantly below the 4.5:1 requirement. The fix is to darken the orange (e.g., #B85C00 achieves 4.56:1) or use it only for large headings where the 3:1 threshold applies. **Non-text example.** A form uses a light gray border (#CCCCCC) on a white background for input fields. The contrast ratio is 1.61:1, failing the 3:1 non-text contrast requirement from SC 1.4.11. Users with low vision cannot perceive the form field boundaries. Darkening the border to #767676 (4.54:1) resolves the issue.
Common Mistakes
**Prioritizing aesthetics over readability.** Designers often choose light grays, pastels, or thin fonts for a clean, modern look. These choices frequently produce contrast below 4.5:1. Accessible design does not mean ugly design — it means choosing from the wide range of color combinations that meet contrast thresholds. **Ignoring hover and focus states.** A link may have sufficient contrast in its default state but lose contrast in its hover or focus state. All visual states of interactive elements must meet contrast requirements. **Forgetting non-text contrast.** Many teams check text contrast but ignore button borders, form field outlines, icon colors, and chart elements. WCAG 1.4.11 applies to all UI components and meaningful graphics. **Testing only against white.** If your page uses a light gray or off-white background (#F5F5F5), contrast ratios will be slightly lower than against pure white. Always measure against the actual background color in your design. **Assuming automated tools catch everything.** Automated scanners test computed styles, but they miss contrast issues on gradient backgrounds, images, and dynamically changed colors. They also miss overlapping elements where a transparent layer reduces effective contrast. Manual verification is still necessary. **Using color alone to convey information.** This is a separate WCAG criterion (1.4.1), but it is closely related. Even with sufficient contrast, using only red versus green to indicate error versus success fails for people with red-green color blindness. Always supplement color with text labels, icons, or patterns. **Ignoring dark mode.** If your site supports dark mode, every color combination must be re-evaluated. Colors that have good contrast on a white background may have poor contrast on a dark background, and vice versa.
Frequently Asked Questions
- What contrast ratio does WCAG require?
- WCAG 2.2 Level AA requires a minimum contrast ratio of 4.5:1 for normal-sized text (below 18pt or 14pt bold) and 3:1 for large text (18pt and above, or 14pt bold and above). Level AAA raises these to 7:1 for normal text and 4.5:1 for large text. Non-text UI components and graphical objects require 3:1 contrast against adjacent colors.
- How is contrast ratio calculated?
- Contrast ratio is calculated using the relative luminance values of two colors. The formula is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color's luminance and L2 is the darker color's luminance. Luminance is derived from sRGB color values using a formula that accounts for how human eyes perceive different wavelengths. Ratios range from 1:1 (no contrast) to 21:1 (black on white).
- What are the best tools for checking color contrast?
- Popular free tools include the WebAIM Contrast Checker (webaim.org/resources/contrastchecker), the Colour Contrast Analyser (CCA) desktop app by TPGi, Chrome DevTools built-in contrast checker, the axe browser extension by Deque, and the Stark plugin for Figma and Sketch. Browser DevTools now show contrast ratios directly in the color picker.
- Does color contrast apply to images of text?
- Yes. WCAG 1.4.3 applies to images of text just as it applies to rendered text. However, WCAG 1.4.5 recommends avoiding images of text entirely when the same visual presentation can be achieved with real text, because real text can be resized, recolored, and read by screen readers more effectively.
- What about contrast for non-text elements like buttons and icons?
- WCAG 2.2 Success Criterion 1.4.11 (Non-text Contrast) requires a minimum 3:1 contrast ratio for user interface components (like button borders and form field outlines) and graphical objects that convey information. This means icon-only buttons, chart data, and interactive element boundaries all need sufficient contrast against their background.
Need help making your website ADA compliant?
Our team specializes in ADA-compliant web design and remediation. Get a free accessibility audit today.
Last updated: 2026-03-15