Home / Articles / WCAG Color Contrast Guide: AA vs AAA Ratios, Examples, and Testing
What is a color contrast ratio?
A contrast ratio compares the relative luminance of a foreground color with the relative luminance of its background. It is expressed as a ratio from 1:1 to 21:1. A value of 1:1 means the two colors have the same luminance; 21:1 represents black against white. The ratio is not a score for how attractive a palette looks. It is a measurable way to evaluate whether text or interface information is sufficiently distinguishable from what sits behind it.
Contrast is especially important for body text, navigation, buttons, form labels, placeholder text, icons that communicate meaning, and charts. A color combination may look clear on a bright monitor but become difficult to read for someone with low vision, color-vision differences, glare, or a dim display. Use a contrast calculation instead of relying only on visual judgement.
WCAG AA and AAA: which ratios matter?
For WCAG 2.1 and 2.2 Level AA, normal text generally needs a contrast ratio of at least 4.5:1. Large-scale text generally needs at least 3:1. Large text is typically at least 18 point regular or 14 point bold, using the WCAG definition. For the enhanced AAA level, normal text generally needs 7:1, while large text needs 4.5:1.
These thresholds are not interchangeable. A pair that passes for large text may fail for normal body copy. Also, the text-size exception does not mean every large button or heading automatically passes; calculate the actual foreground and background colors. Some non-text interface components and graphical objects have separate requirements, so test meaningful controls and visual boundaries too. Consult the W3C WCAG Understanding Contrast Minimum guidance for the formal explanation and exceptions.
How contrast is calculated
The WCAG calculation first converts each sRGB color channel to a linear-light value, then combines the channels using the relative-luminance weights for red, green, and blue. The contrast ratio is calculated by placing the lighter luminance plus 0.05 over the darker luminance plus 0.05. The resulting value is then compared with the relevant threshold.
You do not need to calculate every pair by hand. A reliable contrast checker can accept HEX values and report the ratio and pass/fail status. However, understand what you are testing: enter the actual text color and the exact background behind that text. If a text element sits on a gradient or image, a single flat-color calculation may not represent every point behind the letters. Test the worst-case area or use a design that provides a sufficiently consistent backing surface.
A practical contrast testing workflow
First, list every important foreground/background pair in your interface: body text on page background, headings on surfaces, button labels on button fills, links in paragraphs, navigation text, form labels, and error messages. Test normal and large text against the correct thresholds. Next, inspect focus indicators, borders, icons, and other visual cues that communicate component state. Do not rely on color alone to show success, error, or selection; pair color with text, shape, or an icon.
If a pair fails, try darkening the text, lightening the surface, or choosing a more saturated/darker brand shade. Keep the brand color for large areas or decorative accents if it cannot safely be used for small text. You can also create a separate accessible text-on-brand token rather than forcing one shade to do every job. Run the tests again after changing opacity, overlays, gradients, or theme settings. Use the HexBloom Color Contrast Checker to test your HEX pairs.
Common contrast mistakes to avoid
A common mistake is checking only the primary button and ignoring links, muted labels, placeholder text, disabled-looking controls, or footer copy. Another is testing a color swatch rather than the final rendered color after transparency or an overlay has been applied. Gradients and photographs need special care because contrast can vary across the text area. Avoid using pale gray for essential text simply because it creates a minimal aesthetic.
Also remember that passing a numerical contrast check is one part of accessibility, not a complete accessibility audit. Readable typography, spacing, clear labels, keyboard navigation, visible focus, semantic HTML, and understandable error messages matter too. Make contrast checks part of the design process rather than a final emergency fix.
Frequently asked questions
What is the minimum WCAG AA contrast ratio for normal text?
WCAG AA generally requires at least 4.5:1 contrast for normal text. Large-scale text generally requires at least 3:1.
What is the WCAG AAA contrast ratio?
AAA generally requires 7:1 for normal text and 4.5:1 for large-scale text. AAA is a stricter enhanced level than AA.
Does a large heading need the same contrast as body text?
Not always. WCAG defines large-scale text, which generally has a 3:1 AA threshold and a 4.5:1 AAA threshold. Confirm that the actual font size and weight meet the definition.
Can I use a gradient behind text?
Yes, but contrast can vary across the gradient. Check the lowest-contrast area behind the text or place a solid/controlled overlay behind the text to maintain sufficient contrast.
Does passing a contrast checker make a website fully accessible?
No. Contrast is only one part of accessibility. Also evaluate keyboard access, focus visibility, semantic structure, labels, motion, typography, and whether information is communicated without color alone.
Continue learning with HexBloom
Explore free color tools to generate palettes, check contrast, convert colors, and export developer-ready values.
Explore HexBloom tools