Contrast Ratio Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter the red, green and blue values (0 to 255) of the text color and of the background color.
Result
Contrast ratio (to 1)
Relative luminance of the text color
- Relative luminance of the background
- AA, normal text (4.5:1)
- AA large text and UI components (3:1)
- AAA, normal text (7:1)
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
Affiliate link
This is an affiliate link: FiftyCalc may earn a commission if you buy through it. This does not change the result.
Corel sells CorelDRAW graphic design and technical illustration software. Visit Corel
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Text color: red (0-255): enter a number from 0 to 255.
- Text color: green (0-255): enter a number from 0 to 255.
- Text color: blue (0-255): enter a number from 0 to 255.
- Background: red (0-255): enter a number from 0 to 255.
- Background: green (0-255): enter a number from 0 to 255.
- Background: blue (0-255): enter a number from 0 to 255.
- Read the result: Contrast ratio (to 1); the panel also shows Relative luminance of the text color, Relative luminance of the background, AA, normal text (4.5:1), AA large text and UI components (3:1) and AAA, normal text (7:1).
How this calculator works
Contrast ratio = (L1 + 0.05) / (L2 + 0.05), with L1 the relative luminance of the lighter color and L2 of the darker one, from the W3C Web Content Accessibility Guidelines (WCAG) 2.2 (w3.org/TR/WCAG22, read 2026-10-27).
Relative luminance L = 0.2126 R + 0.7152 G + 0.0722 B, where each channel is c = value / 255, then c / 12.92 if c ≤ 0.04045, else ((c + 0.055) / 1.055)^2.4.
WCAG 2.2 thresholds: 4.5:1 for normal text and 3:1 for large text (1.4.3, level AA); 7:1 and 4.5:1 (1.4.6, level AAA); 3:1 for user interface components and graphics (1.4.11).
Worked example
| Text color: red (0-255) | 118 |
|---|---|
| Text color: green (0-255) | 118 |
| Text color: blue (0-255) | 118 |
| Background: red (0-255) | 255 |
| Background: green (0-255) | 255 |
| Background: blue (0-255) | 255 |
| Relative luminance of the text color | 0.1812 |
|---|---|
| Relative luminance of the background | 1 |
| Contrast ratio (to 1) | 4.54 |
| AA, normal text (4.5:1) | Pass |
| AA large text and UI components (3:1) | Pass |
| AAA, normal text (7:1) | Fail |
Frequently asked questions
What contrast ratio does WCAG AA require?
At least 4.5:1 for normal text and 3:1 for large text.
Does gray #767676 on white pass AA?
Yes, just: RGB 118, 118, 118 on white gives about 4.54:1.
What is the highest possible contrast ratio?
21:1, black on white.