Technology
Color Contrast Checker: A Practical Guide to WCAG Ratios
Learn how color contrast ratios are calculated, what the WCAG AA and AAA thresholds mean, and how to check any color pair for accessible, readable text.
Try it now
Color Contrast Checker
Check text/background color contrast against WCAG AA and AAA levels.
Color Contrast Checker: A Practical Guide to WCAG Ratios
Beautiful design is worthless if people cannot read it. Light gray text on a white background may look elegant on a designer’s high-end monitor, but for a user with low vision, aging eyes, or a phone in bright sunlight, it can be completely illegible. Color contrast is the measurable difference in brightness between text and its background, and getting it right is one of the most impactful things you can do for accessibility.
The web accessibility standard WCAG (Web Content Accessibility Guidelines) defines exact numeric thresholds for acceptable contrast, and a color contrast checker tells you instantly whether any two colors meet them. This guide explains what the contrast ratio is, how it is calculated from raw color values, what the AA and AAA levels require, and how to use a checker to build interfaces everyone can read.
What Is a Contrast Ratio?
A contrast ratio is a single number, ranging from 1:1 to 21:1, that quantifies how different two colors are in luminance—their perceived brightness. The extremes are easy to picture:
- 21:1 is the maximum, achieved by pure black text on a pure white background.
- 1:1 is the minimum, achieved when the two colors are identical and text vanishes entirely.
Everything readable falls in between. Crucially, contrast is about brightness, not hue. Two colors can be wildly different in color—bright red and bright green, for instance—yet have similar luminance, producing a low, hard-to-read contrast ratio. This is why a checker measures light, not color name.
How the Contrast Ratio Is Calculated
The WCAG contrast formula is precise and worth understanding. It proceeds in three stages: linearize each channel, compute relative luminance, and form the ratio.
Step 1: Linearize Each Color Channel
Screen colors are stored in the sRGB space, which is gamma-encoded—the stored value is not proportional to actual light output. To measure real brightness we must convert each 8-bit channel value (0–255) back to linear light. For each channel value v:
s = v / 255
linear = s ≤ 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ^ 2.4
The small linear segment near black handles very dark values, while the power curve handles the rest.
Step 2: Compute Relative Luminance
The human eye is far more sensitive to green than to red or blue, so the linear channels are weighted accordingly and summed into a single luminance value L:
L = 0.2126 × R_linear + 0.7152 × G_linear + 0.0722 × B_linear
Green contributes over 70% of perceived brightness, which is why bright green text feels lighter than bright blue text of the same numeric intensity.
Step 3: Form the Ratio
With a luminance for both the foreground and background, the ratio is:
contrast ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05)
The + 0.05 term represents ambient screen glare and prevents division by zero for pure black. The lighter color always goes on top so the ratio is at least 1.
A Worked Example
Consider mid-gray text #595959 on a white #FFFFFF background.
For white, every channel is 255, so s = 1, linear = 1 for all three, and L = 0.2126 + 0.7152 + 0.0722 = 1.0.
For #595959, each channel is 89. Then s = 89 / 255 ≈ 0.349, which is above 0.03928, so linear = ((0.349 + 0.055) / 1.055) ^ 2.4 ≈ 0.1017. Since all three channels are equal, L ≈ 0.1017.
The ratio is (1.0 + 0.05) ÷ (0.1017 + 0.05) = 1.05 ÷ 0.1517 ≈ 6.9:1, which rounds to about 7.0:1—just enough to pass the strictest AAA level for normal text.
Understanding WCAG AA and AAA Thresholds
WCAG defines two conformance levels, each with different requirements for normal and large text. Large text means 18pt (about 24px) regular weight, or 14pt (about 18.66px) bold and above, because bigger letters are inherently easier to read at lower contrast.
- AA normal text: at least 4.5:1
- AA large text: at least 3:1
- AAA normal text: at least 7:1
- AAA large text: at least 4.5:1
AA is the practical baseline required by most accessibility laws and adopted by the vast majority of organizations. AAA is an enhanced target offering the best readability for users with significant visual impairment; meeting it everywhere is not always feasible, so it is often reserved for critical content. WCAG 2.1 also added a separate 3:1 minimum for meaningful non-text elements like button borders and icons.
How to Use the Color Contrast Checker
The tool is straightforward:
- Choose a foreground (text) color using the color picker or by typing a hex value like
#333or#336699. - Choose a background color the same way.
- Read the contrast ratio shown as a value such as
6.90:1, along with PASS/FAIL badges for AA normal, AA large, AAA normal, and AAA large.
A live preview shows your actual colors together so you can judge readability by eye as well as by number. The checker accepts both 3-digit shorthand (#abc) and full 6-digit hex, expanding shorthand automatically.
Tips for Achieving Accessible Contrast
- Design for AA, aspire to AAA. Treat 4.5:1 as your non-negotiable floor for body text and push toward 7:1 where you can.
- Adjust lightness, not just hue. If a brand color fails, darken or lighten it rather than changing the color entirely to preserve identity while gaining contrast.
- Do not rely on color alone. Contrast helps, but always pair color with text labels, icons, or underlines so colorblind users are not left guessing.
- Test the real combinations. Check text against every background it will sit on, including hover states, cards, and images.
Common Use Cases
Designers use a contrast checker to validate a palette before handing off to development. Developers use it to audit existing pages for low-contrast text flagged in accessibility reviews. Content teams use it when choosing link and button colors, and QA teams use it to confirm compliance with legal standards like the ADA or EN 301 549 before launch.
Conclusion
Color contrast is not a matter of taste—it is a measurable, calculable property that determines whether real people can read your content. By linearizing color channels, weighting them into a luminance value, and forming a simple ratio, WCAG gives us objective thresholds that separate accessible design from exclusionary design. Check your colors against AA and AAA before you ship, and no user will be left squinting. Try our free Color Contrast Checker for instant results.
OurDailyCalc Team
OurDailyCalc — beautiful tools for everyday calculations.