Contrast Ratio Calculator
Check WCAG contrast ratio between any two colors. See AA and AAA pass/fail status for normal and large text.
Quick Answer
WCAG AA requires 4.5:1 contrast for normal text and 3:1 for large text. AAA requires 7:1 and 4.5:1 respectively. Enter your foreground and background colors to check compliance.
Check Contrast
Enter foreground and background colors in hex format.
The quick brown fox jumps over the lazy dog
This is how your text will look with these color choices. Check the contrast ratio below.
About This Tool
The Contrast Ratio Calculator is an essential accessibility tool for web designers, developers, and content creators. It calculates the WCAG (Web Content Accessibility Guidelines) contrast ratio between any foreground and background color pair and instantly shows whether the combination meets AA and AAA conformance levels for both normal and large text. Use it during the design phase to ensure your color palette is accessible to all users, including those with visual impairments.
What Is Contrast Ratio?
Contrast ratio is a numerical measure of the difference in perceived brightness between two colors. It is calculated using the relative luminance of each color — a value that accounts for how the human eye perceives different wavelengths of light (we are most sensitive to green, less to red, and least to blue). The formula yields a ratio between 1:1 (no contrast, identical colors) and 21:1 (maximum contrast, black on white). Higher ratios mean more visible, readable text.
WCAG Conformance Levels
WCAG 2.1 defines two conformance levels for color contrast. Level AA is the minimum standard that most organizations should meet. It requires a 4.5:1 ratio for normal-sized text and 3:1 for large text (18pt/24px regular or 14pt/18.66px bold). Level AAA is the enhanced standard that provides the best readability. It requires 7:1 for normal text and 4.5:1 for large text. While AAA for all content is ideal, it is often impractical for complex designs — most guidelines recommend AAA for body text and AA for secondary elements.
The Science Behind Relative Luminance
The contrast ratio formula is grounded in color science. First, each RGB color channel (0-255) is converted from sRGB gamma-encoded space to linear light values using an inverse transfer function. Then relative luminance is calculated as a weighted sum: L = 0.2126R + 0.7152G + 0.0722B. These weights come from the CIE 1931 color matching functions and reflect the spectral sensitivity of human cone cells. Green contributes the most to perceived brightness (71.52%), followed by red (21.26%), then blue (7.22%). This is why pure green (#00FF00) appears much brighter than pure blue (#0000FF) at the same hex intensity.
Common Accessibility Mistakes
The most common contrast failure is light gray text on white backgrounds — often used for placeholder text, captions, or disabled states. Even gray as dark as #767676 barely passes AA at 4.54:1. Other frequent failures include colored text on colored backgrounds (blue on purple, orange on yellow), text over images without an overlay, and gradient backgrounds where contrast varies across the element. Always test the worst-case point in a gradient, not just the average. Placeholder text and disabled states should still meet at least 3:1 for usability, even though WCAG does not strictly require it.
Beyond Contrast Ratio
While contrast ratio is the primary WCAG metric, true color accessibility involves more considerations. Color should never be the only means of conveying information (WCAG 1.4.1) — always pair color indicators with text, icons, or patterns. Test your palette with color blindness simulators to ensure meaning is preserved for users with deuteranopia, protanopia, and tritanopia. Consider font weight and size: thin fonts need higher contrast than bold fonts at the same size. And remember that contrast needs increase in bright ambient light (sunlight) and on lower-quality displays.