Understanding Colour Contrast Ratio

Colour contrast ratio quantifies the perceived difference in brightness between two colours. The metric ranges from 1:1 (identical colours) to 21:1 (maximum difference, typically black on white). The W3C's Web Content Accessibility Guidelines (WCAG) define minimum contrast thresholds to ensure text remains legible for all users, regardless of visual ability.

The contrast ratio directly affects readability. Low contrast—such as yellow text on a white background—forces viewers to strain their eyes and may exclude people with colour blindness or age-related vision loss. Conversely, high contrast improves scanning speed and comprehension, benefiting both accessibility and user experience broadly.

Two conformance levels govern web content:

  • AA: Minimum threshold—4.5:1 for normal text, 3:1 for large text (18pt or 14pt bold and above).
  • AAA: Enhanced standard—7:1 for normal text, 4.5:1 for large text. Recommended for critical content.

Calculating Contrast Ratio from Luminance

If you know the relative luminance of both colours, the contrast ratio calculation is direct. Relative luminance (RL) is derived from RGB values using a weighted formula that accounts for human perception of colour brightness.

RL = 0.2126 × R + 0.7152 × G + 0.0722 × B

Contrast Ratio = (RL₁ + 0.05) ÷ (RL₂ + 0.05)

  • RL — Relative luminance of a colour, ranging from 0 (darkest) to 1 (lightest).
  • R, G, B — Red, green, and blue channel values (0–255 or 0–1 depending on the model). Each is first adjusted if the value exceeds 0.03928 using a gamma correction curve.
  • Contrast Ratio — The final accessibility metric. Higher values indicate greater distinction between the two colours.

Working with Multiple Colour Models

Colour can be defined in different models depending on the context and software used:

  • RGB: Additive colour mixing—common for screens and digital displays. Values range from 0–255 per channel.
  • HSL: Hue, saturation, lightness. Intuitive for designers choosing colours by perceptual properties rather than channel values.
  • HSV: Hue, saturation, value. Similar to HSL but saturates colour at the lighter end; preferred in some design applications.
  • CMYK: Subtractive colour mixing for print materials. Requires conversion to RGB before calculating luminance.

Regardless of which model you input, the calculator converts to relative luminance using standardised algorithms, ensuring consistent and accurate contrast ratios across all colour spaces.

Practical Accessibility Considerations

Avoid common mistakes that undermine accessible design:

  1. Colour alone is insufficient — Never rely solely on colour to convey information. Use text labels, patterns, or icons alongside colour to ensure people with colour blindness can parse your interface.
  2. Test with actual users and tools — Manual calculation is useful, but real-world rendering varies by monitor brightness and ambient lighting. Always review your design on multiple screens and use browser extensions to simulate colour vision deficiency.
  3. Large text permits lower ratios — WCAG permits 3:1 contrast for text 18pt or larger (or 14pt if bold). Verify font size assumptions; what appears large on desktop may not on mobile devices.
  4. Aim beyond the minimum — Meeting AA (4.5:1) satisfies legal requirements for many jurisdictions, but AAA (7:1) provides a buffer for degraded viewing conditions, older monitors, or users with moderate vision loss.

Why WCAG Standards Matter

The Web Content Accessibility Guidelines evolved from decades of research by the World Wide Web Consortium (W3C) and its Accessibility Guidelines Working Group. WCAG conformance is now legally mandated or strongly recommended in many countries, including the USA (under the ADA), UK, EU, and others.

Beyond compliance, accessible design benefits everyone. Clear contrast reduces cognitive load, improves focus, and supports reading in bright sunlight or on lower-quality screens. These principles apply equally to websites, mobile apps, and printed materials, making them a sound investment in user experience quality.

Frequently Asked Questions

What contrast ratio should I target for my website?

Aim for at least 4.5:1 for body text and 3:1 for large text to meet WCAG AA, the widely accepted baseline. If serving an older audience or content-heavy site, pursue 7:1 and 4.5:1 respectively (WCAG AAA). Test your design on real devices and across different lighting conditions; calculated ratios may feel different in practice.

How do I find the relative luminance of a colour?

Relative luminance is calculated from the colour's RGB values using a weighted formula that reflects human sensitivity to green light. Each channel (R, G, B) undergoes gamma correction before weighting: red at 0.2126, green at 0.7152, and blue at 0.0722. The calculator automates this conversion, but you can verify results using online luminance tools or WCAG's published algorithms.

Can I use contrast ratios from any colour model?

Yes. RGB, HSL, HSV, and CMYK are all converted to relative luminance internally, which is the foundation of the contrast ratio calculation. The colour model you choose depends on your workflow: use RGB for web, HSL for intuitive design, HSV for certain graphics applications, or CMYK if working in print. The final contrast ratio will be identical.

What's the difference between AA and AAA conformance?

AA is the legal and industry standard—4.5:1 for normal text, 3:1 for large. AAA is an enhanced level requiring 7:1 and 4.5:1 respectively, recommended for critical content, educational materials, and sites serving users with vision impairments. Achieving AAA is not mandatory but signals a strong commitment to accessibility.

Does screen brightness affect my contrast ratio calculations?

The formula itself is based on standardised luminance values and is independent of display settings. However, perceived contrast varies with monitor calibration, ambient light, and viewer eyesight. Always preview your design in realistic conditions and ask users with different visual abilities to review it.

What's the highest possible contrast ratio?

The theoretical maximum is 21:1, achieved by pairing pure black (#000000) with pure white (#FFFFFF). In practice, true black and white are rarely used for body text due to eye strain and readability concerns. Most well-designed interfaces use dark grays on light backgrounds or vice versa, yielding ratios between 5:1 and 15:1.

More other calculators (see all)