Home · Math · Ratios & Proportions · Contrast Ratio Calculator
Contrast Ratio Calculator
The WCAG contrast formula adds 0.05 to both relative luminances before dividing, which keeps the ratio finite for pure black; luminances are entered as decimals between 0 and 1.
What this calculator does
The WCAG contrast formula adds 0.05 to both relative luminances before dividing, which keeps the ratio finite for pure black; luminances are entered as decimals between 0 and 1. Every figure on this page is computed from the formula or definition stated below, with no hidden rounding steps, and the method notes name the exact convention where more than one exists.
The formula and method
The WCAG contrast formula adds 0.05 to both relative luminances before dividing, which keeps the ratio finite for pure black; luminances are entered as decimals between 0 and 1.
Inputs use the units shown in the field labels and every denominator or total must be non-zero. The result is an arithmetic value from the stated formula only; it is not a quote, a rating or professional advice.
Worked example
With the example inputs this page opens with (relative luminance of the lighter colour (0–1) 0.8, relative luminance of the darker colour (0–1) 0.1), the result is 5.67 — contrast ratio. Change any figure and the result updates with the same formula.
Quick reference
| Relative luminance of the lighter colour (0–1) | Contrast ratio |
|---|---|
| 0.4 | 3.00 |
| 0.64 | 4.60 |
| 0.8 | 5.67 |
| 1 | 7.00 |
| 1.2 | 8.33 |
| 1.6 | 11.00 |
Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.
Common questions
How does the Contrast Ratio Calculator work?
The WCAG contrast formula adds 0.05 to both relative luminances before dividing, which keeps the ratio finite for pure black; luminances are entered as decimals between 0 and 1. Relative luminance of the lighter colour · Relative luminance of the darker colour → Contrast ratio. The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.
What inputs does the Contrast Ratio Calculator need?
Relative luminance of the lighter colour · Relative luminance of the darker colour → Contrast ratio. Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.
Is the Contrast Ratio Calculator free to use?
Yes. It runs entirely in your browser with no sign-up, and the same calculator is available as an embeddable widget via the Embed button, so it can be placed on another site with its calculation intact.