What is Color Contrast?
Color contrast refers to the difference in luminance between a foreground color (typically text) and a background color. Sufficient contrast ensures that text is readable for all users, including those with low vision, color blindness, or who are viewing content in bright sunlight or on low-quality screens.
Why WCAG Contrast Standards Exist
The Web Content Accessibility Guidelines (WCAG) are published by the W3C and are referenced by accessibility laws in many countries (including the EU’s EN 301 549, the US’s ADA and Section 508, and the UK’s Equality Act). Meeting WCAG contrast requirements is often a legal obligation for public sector websites and a best practice for all others.
How to Use This Tool
- Choose a foreground color (your text color) using the color picker or by typing a hex code like
#333333 - Choose a background color using the same method
- The contrast ratio and WCAG pass/fail badges update instantly
- Use Swap colors to check the reverse combination
- Use Suggest readable text color to automatically pick black or white — whichever gives better contrast on your background
WCAG Contrast Requirements
| Level | Normal text | Large text |
|---|---|---|
| AA | 4.5:1 | 3.0:1 |
| AAA | 7.0:1 | 4.5:1 |
Large text is defined as at least 18pt (24px) for regular weight, or 14pt (~18.67px) for bold text.
Level AA is the minimum standard required by most accessibility regulations. Level AAA is an enhanced standard recommended for text-heavy or accessibility-critical applications.
Understanding the Contrast Ratio
The contrast ratio is a number between 1:1 (no contrast — identical colors) and 21:1 (maximum contrast — pure black on pure white). The formula is:
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 is calculated from the sRGB values using the WCAG-specified linearization formula.
Common Contrast Pitfalls
- Light gray text on white — very common on modern minimalist designs, but often fails AA
- Brand color on white — many brand colors (especially pastels or mid-tone blues/greens) fail 4.5:1
- White text on light backgrounds — photos or gradients may have insufficient contrast in some regions
- Placeholder text — browser default placeholder color (light gray) almost universally fails WCAG
Privacy
All contrast calculations happen in your browser using JavaScript. No color values or other data are sent to a server.