⚖️ Contrast Ratio Checker

Last updated: April 7, 2026

Contrast Ratio Checker

Test text and background color pairs against WCAG AA & AAA accessibility standards

Please enter valid hex colors (e.g. #ff0000 or #f00).
Live Preview
The quick brown fox jumps over the lazy dog.
Large Bold Heading
Contrast Ratio
:1

Why Contrast Ratio Is the Foundation of Accessible Web Design

When a designer picks colors for a website, they are making a choice that will affect every single visitor — including the roughly 300 million people worldwide who live with some form of color vision deficiency, the one-in-three adults over 65 who experience age-related contrast sensitivity loss, and the far larger number of people reading on a glaring phone screen in direct sunlight. Contrast ratio is not a stylistic preference. It is the quantitative measure that separates a legible experience from an exclusionary one.

The Web Content Accessibility Guidelines (WCAG), published by the W3C, formalized contrast requirements that are now baked into accessibility laws in the European Union, the United States (Section 508 and ADA case law), Canada, Australia, and the UK. Understanding exactly what those numbers mean — and how to test any color pair in seconds — is an essential skill for anyone who ships digital products.

How the Contrast Ratio Is Actually Calculated

The contrast ratio between two colors is not simply the visual difference you perceive — it is derived from relative luminance, a perceptual model rooted in how the human eye responds to light. The formula computes a value between 1:1 (no contrast whatsoever, like black on black) and 21:1 (the theoretical maximum, achieved by pure black on pure white).

The process works in three stages. First, each RGB channel value (0–255) is converted to a linear light value by reversing the gamma encoding that monitors apply. Second, those linearized values are weighted and summed using the coefficients 0.2126 for red, 0.7152 for green, and 0.0722 for blue — weights that reflect the fact that the human eye is most sensitive to green wavelengths and least sensitive to blue. The result is the relative luminance (L) of that color. Finally, the luminance of the lighter color plus 0.05 is divided by the luminance of the darker color plus 0.05 (the 0.05 offset accounts for ambient flare in real viewing environments), and the result is expressed as a ratio like 4.58:1.

This is why two colors can look very different to a designer yet still fail contrast requirements. A vivid red (#ff0000) on a pure white background only achieves a 4.0:1 ratio — it fails WCAG AA for normal-sized text, despite appearing eye-catching. Conversely, a dark navy on a pale blue can feel almost monochromatic yet pass comfortably because both lie at similar luminance extremes.

WCAG AA vs AAA: What the Levels Actually Require

WCAG defines two compliance tiers most organizations target — AA and AAA — and both tiers have different requirements depending on the size and weight of the text.

AA (the legal baseline): Normal text (below 18pt or 14pt bold) needs a minimum contrast ratio of 4.5:1. Large text (18pt and above, or 14pt and above in bold) only requires 3.0:1, because larger glyphs are inherently easier to resolve at lower contrast. This distinction matters enormously in practice: a heading at 24px bold might pass AA at 3.5:1 while the body copy directly beneath it using the same color pair would fail.

AAA (the gold standard): Normal text must meet 7.0:1, and large text must clear 4.5:1. AAA is not mandated for entire pages — WCAG explicitly states it is "not possible to satisfy all Level AAA Success Criteria for some content" — but it represents best-practice accessibility for body copy on public services, medical information, legal documents, and any context where reading failure carries real-world consequences.

There is one important category WCAG does not regulate via contrast ratio: decorative text (logos, incidental imagery, CAPTCHA), text in inactive UI components, and text that is part of a picture where other content is present. Knowing these carve-outs prevents teams from chasing impossible compliance targets on elements that are intentionally exempt.

Common Mistakes Designers Make With Color Contrast

The most frequent error is testing color pairs in a design tool rather than in a purpose-built contrast checker. Design applications render colors under color management profiles that may not match what a browser outputs. A color pair approved at 4.6:1 in a design mockup might land at 4.3:1 in the actual browser because of profile mismatch. Always test the hex values that will ship in the CSS.

A second trap is what might be called the brand color problem. Marketing teams often lock in primary colors that look authoritative in isolation — a medium-saturated orange, a mid-tone teal, a corporate red — without realizing those colors sit in exactly the luminance range that produces the lowest contrast values. A 50% saturated color tends to be the hardest to pair accessibly with either a light or dark background. The fix is rarely to abandon the brand color; it is to shift the text or background slightly toward the extremes, or to use the brand color only for large-text contexts where the 3.0:1 threshold applies.

A subtler mistake is testing only the primary state of interactive elements. A button that passes at 5:1 in its default state may drop to 2.8:1 when hovered or disabled. WCAG 1.4.3 applies to all text in all meaningful states, not just the resting appearance.

Practical Workflow for Getting Contrast Right

Start at the token level, not the component level. Define your palette's semantic roles — surface, on-surface, primary, on-primary — and test every role against every surface it will appear on before writing a single line of UI code. This upstream approach eliminates the painful retroactive fixes that happen when contrast violations are caught in QA or, worse, in an accessibility audit after launch.

Document your ratios alongside your design tokens. A comment in your CSS variables file that reads /* on-surface-text: #1a1a2e on #f8f9fc → 17.2:1 AAA */ takes five seconds to write and saves hours of re-testing across sprints. When someone later changes the background in a brand refresh, that annotation flags exactly what needs to be re-verified.

For teams using dark mode, remember that luminance relationships invert but ratios do not automatically follow. A pair that passes in light mode at 6.5:1 may or may not produce an equivalent dark-mode pair just by swapping colors. Calculate both independently.

Beyond WCAG: What WCAG 3.0 Changes

The upcoming WCAG 3.0 standard (still in working draft as of 2025) introduces a new contrast model called APCA — Advanced Perceptual Contrast Algorithm — which replaces the current luminance-ratio approach. APCA accounts for factors the current model ignores: font weight, character size, and the non-linear nature of human perception at very small or very large text sizes. Under APCA, the binary pass/fail of AA and AAA is replaced by a Bronze/Silver/Gold scoring system.

For now, the WCAG 2.x AA/AAA standards remain the legal and practical benchmark everywhere. But teams building component libraries today should be aware that a transition is coming, and keeping contrast ratios comfortably above the minimums — rather than scraping by at 4.5:1 — creates natural buffer for future compliance without a design overhaul.

The bottom line is this: contrast ratio is not bureaucratic box-ticking. It is the single most impactful accessibility intervention available to a design team, requiring no assistive technology, no specialized markup, and no runtime overhead. It is a pure design decision with direct, measurable consequences for every human being who reads your interface.

FAQ

What contrast ratio is required to pass WCAG AA for normal body text?
WCAG AA requires a minimum contrast ratio of 4.5:1 for normal text (text below 18pt in regular weight, or below 14pt in bold). For large text — 18pt (approximately 24px) and above, or 14pt (approximately 18.67px) and above in bold — the minimum drops to 3.0:1. AA is the standard referenced by most accessibility laws worldwide.
What is the difference between WCAG AA and AAA contrast levels?
AA is the baseline legal and practical standard: 4.5:1 for normal text and 3.0:1 for large text. AAA is the enhanced level: 7.0:1 for normal text and 4.5:1 for large text. AAA is not required for entire pages, but it provides significantly better readability for users with low vision, cataracts, or age-related contrast sensitivity decline. Aim for AAA on body text whenever your color palette allows it.
Does a logo or decorative image text need to pass the contrast ratio test?
No. WCAG 1.4.3 explicitly exempts text that is part of a logo or brand name, purely decorative text with no informational purpose, text in inactive (disabled) UI components, and text that is part of a picture where significant other visual content is present. These exemptions exist because enforcing contrast on purely decorative elements would conflict with legitimate artistic expression.
Why does my red or orange brand color keep failing contrast tests?
Mid-saturation warm colors like red, orange, and medium teal sit in a luminance range that produces relatively low contrast against both white and black. Pure red (#ff0000) on white achieves only about 4.0:1 — just below the 4.5:1 AA threshold. The fix is to darken the foreground color slightly (shift toward maroon or deep teal) or lighten the background, rather than abandoning the brand hue entirely. Using the brand color only for large text (where 3.0:1 suffices) is another practical strategy.
Does the contrast ratio requirement apply to placeholder text and icon-only buttons?
Placeholder text inside form fields is considered informational and must meet the 4.5:1 ratio under WCAG 1.4.3. Icon-only buttons (where the icon conveys meaning without a visible text label) fall under WCAG 1.4.11 (Non-text Contrast), which requires a 3.0:1 ratio against adjacent colors for the icon's meaningful boundaries — a separate, slightly different requirement from the text contrast rules.
How is contrast ratio different from color difference or hue distance?
Contrast ratio is derived from relative luminance — a perceptually weighted brightness calculation that accounts for how the human eye processes different wavelengths of light. Color difference metrics (like CIE Delta-E or simple hue angle) measure how distinct two colors look to an average observer with full color vision. Contrast ratio is specifically designed to predict readability for people with color vision deficiencies, who may not perceive hue differences at all but are still sensitive to luminance contrast. Two colors can be dramatically different in hue yet have a near-identical luminance — resulting in a ratio close to 1:1 and failing completely.