Developer

WCAG Color Contrast Explained: AA and AAA Ratios

ToolOrbit Engineering 2 min readUpdated
WCAG Color Contrast Explained: AA and AAA Ratios

Readable text is the foundation of an accessible interface, and readability comes down to contrast between the text and its background. The Web Content Accessibility Guidelines (WCAG) define exact contrast ratios that color combinations must meet. The ToolOrbit Color Contrast Checker computes that ratio and tells you instantly whether a pairing passes AA or AAA.

How the contrast ratio is calculated

WCAG measures contrast as the ratio between the relative luminance of the lighter color and the darker color. The result ranges from 1:1 for identical colors up to 21:1 for pure black on pure white. The calculation accounts for how human eyes perceive different color channels, so it is not a simple difference of brightness.

#595959 on #FFFFFF  ->  7.0:1  (AAA pass)
#777777 on #FFFFFF  ->  4.48:1 (AA pass, AAA fail)
#AAAAAA on #FFFFFF  ->  2.32:1 (fail)

What the WCAG thresholds require

  • AA normal text: at least 4.5:1
  • AA large text (18pt or 14pt bold): at least 3:1
  • AAA normal text: at least 7:1
  • AAA large text: at least 4.5:1
  • UI components and graphical objects: at least 3:1
Tip: Large text gets a lower threshold because bigger shapes are easier to read. Confirm your font actually qualifies as large before relying on the relaxed 3:1 ratio.

Using the checker

Enter a foreground and background color as hex values and the checker shows the ratio along with clear pass or fail badges for each WCAG level. Adjust the colors until you clear the threshold you are targeting. Everything is calculated in your browser, with a live preview so you can judge readability with your own eyes too.

Best practices

Design for AA as a baseline and reach for AAA on body text where you can. Never rely on color alone to convey meaning, since contrast helps low-vision users but not those who cannot distinguish hues. Check your hover, focus, and disabled states as well, because they are easy to forget and often fall below the line.

Large-text and component rules

WCAG gives large text an easier bar (3:1) than normal text (4.5:1) because thicker letterforms tolerate lower contrast. That only helps sizes like 18pt (24px) regular or 14pt (18.66px) bold and above — a slightly bigger button label still needs the full ratio. Non-text UI like focus indicators and icon boundaries want at least 3:1 against their backgrounds, which is exactly why a checker with a live ratio readout beats eyeballing it in design tools.

  • Design in gray-scale-light contrast? No — test actual pairs.
  • Focus styles: check the ring color against both the background and the bordered element.
  • Test on both the light theme and the dark theme; ratio flips between them.

Tools mentioned

More reading

View all guides
What Is Base64? How Encoding Works and Common Mistakes
Developer

What Is Base64? How Encoding Works and Common Mistakes

What Base64 encoding actually does, where it is used, and the mistakes that cause broken or oversized output.

2 min readUpdated
encodeURI vs encodeURIComponent: Which One to Use
Developer

encodeURI vs encodeURIComponent: Which One to Use

How percent-encoding works, the difference between encoding a whole URL and a single component, and the mistakes that break links.

2 min readUpdated
What Is a UUID? Version 4 vs Version 7 Explained
Developer

What Is a UUID? Version 4 vs Version 7 Explained

What a UUID looks like, why version 4 is the safe default, when version 7 is better, and best practices for IDs.

2 min readUpdated
How SHA-256 and SHA-512 Hashes Work: Hashing vs Encryption
Developer

How SHA-256 and SHA-512 Hashes Work: Hashing vs Encryption

What a hash function does, how to choose between SHA-256 and SHA-512, and why hashing is not encryption.

2 min readUpdated
What Is a JWT? Header, Payload and Signature Explained
Developer

What Is a JWT? Header, Payload and Signature Explained

A JSON Web Token has three parts. Learn what the header, payload and signature contain, how to read the claims, and why decoding is not verifying.

2 min readUpdated
What Is HTML Encoding? Entities & Escaping Explained
Developer

What Is HTML Encoding? Entities & Escaping Explained

Learn how HTML encoding works, why escaping prevents XSS and layout breaks, and how to encode and decode named, decimal, and hex entities.

2 min readUpdated
Unix Time Explained: Seconds, Milliseconds and Time Zones
Developer

Unix Time Explained: Seconds, Milliseconds and Time Zones

What a Unix timestamp is, how to tell seconds from milliseconds, how time zones come into it, and the values worth recognising.

2 min readUpdated
Binary, Octal, Decimal and Hex: How Number Bases Work
Developer

Binary, Octal, Decimal and Hex: How Number Bases Work

How positional number bases work, why very large values need exact arithmetic, and the hex and binary values you meet every day.

2 min readUpdated