Contrast Ratio Calculator
Check WCAG 2.1 contrast ratio between foreground and background colors.
About this calculator
WCAG contrast ratio measures how easily text stands out from its background, and it's computed from relative luminance rather than raw color difference — two colors can look quite different to the eye yet still fail a contrast check if their luminance values are close, because contrast is fundamentally about brightness separation, not hue. This calculator converts each RGB channel from its 0-255 sRGB value into linear light using the sRGB gamma curve, since the eye's brightness perception and a monitor's raw pixel values don't scale the same way, then combines the three linearized channels with the standard weighting of 21.26% red, 71.52% green, and 7.22% blue — green is weighted far more heavily because the human eye is most sensitive to green light, so identical-magnitude changes in blue barely move perceived brightness while the same change in green moves it substantially.
The final ratio is the lighter color's luminance plus a small offset, divided by the darker color's luminance plus the same offset, which produces a range from 1:1 (identical colors, no contrast at all) up to 21:1 (pure black against pure white, the maximum possible contrast in sRGB). This calculator implements the formula exactly as the W3C's Web Content Accessibility Guidelines (WCAG) 2.1 define it, and applies the four thresholds WCAG 2.1 sets depending on text size and conformance level: Success Criterion 1.4.3 (Contrast Minimum, Level AA) requires at least 4.5:1 for normal-size text and 3:1 for large text (18pt or larger, or 14pt bold), while the stricter Success Criterion 1.4.6 (Contrast Enhanced, Level AAA) raises those to 7:1 and 4.5:1 respectively, since larger characters remain legible at lower contrast than small text does.
Inputs
Results
Contrast Ratio
19.16:1
Figures current as of 2018. Sources: W3C Web Content Accessibility Guidelines (WCAG) 2.1 — SC 1.4.3 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large-scale text (18pt+, or 14pt+ bold); the contrast-ratio and relative-luminance formulas ((L1+0.05)/(L2+0.05), and L = 0.2126R + 0.7152G + 0.0722B) are defined in the same guidelines., W3C WCAG 2.1 — SC 1.4.6 requires a contrast ratio of at least 7:1 for normal text and 4.5:1 for large-scale text, the stricter AAA conformance level.
How to Use This Calculator
- Enter the Foreground RGB values (text or icon color) and Background RGB values.
- Review the Contrast Ratio expressed as X:1.
- Check WCAG AA compliance: 4.5:1 required for normal text, 3:1 for large text (18pt+ or 14pt bold).
- Check WCAG AAA compliance: 7:1 required for normal text, 4.5:1 for large text.
- Adjust your foreground or background color until the ratio meets the target accessibility standard.
How the result changes with Foreground Green
| Foreground Green | Contrast Ratio |
|---|---|
| 128 | 8.93:1 |
| 191 | 12.91:1 |
| 255 | 19.16:1 |
What each input means
- Foreground Red
- Red channel of the text/foreground color.
- Foreground Green
- Green channel of the text/foreground color.
- Foreground Blue
- Blue channel of the text/foreground color.
- Background Red
- Red channel of the background color.
- Background Green
- Green channel of the background color.
- Background Blue
- Blue channel of the background color.
How this is calculated
Worked example, using the default values
- Identify Input Parameters4 parametersForeground Red = 255, Foreground Green = 255, Foreground Blue = 255, Background Red = 10 = 6 input(s) provided
- Calculate Contrast Ratio19.16 = 19.16
- Calculate AA Normal TextAA Normal Text1 = 1
- Calculate AA Large TextAA Large Text1 = 1
Figures and sources
- WCAG 2.1 Success Criterion 1.4.3 (Contrast Minimum, Level AA) (2018) — W3C Web Content Accessibility Guidelines (WCAG) 2.1 — SC 1.4.3 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large-scale text (18pt+, or 14pt+ bold); the contrast-ratio and relative-luminance formulas ((L1+0.05)/(L2+0.05), and L = 0.2126R + 0.7152G + 0.0722B) are defined in the same guidelines.
- WCAG 2.1 Success Criterion 1.4.6 (Contrast Enhanced, Level AAA) (2018) — W3C WCAG 2.1 — SC 1.4.6 requires a contrast ratio of at least 7:1 for normal text and 4.5:1 for large-scale text, the stricter AAA conformance level.
Engine last updated . Checked against 2 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Why does contrast ratio depend on luminance instead of just how different the colors look?
Contrast ratio is specifically a brightness measurement, not a general color-difference measurement — two colors of very different hue can share nearly identical luminance and fail a contrast check, while two colors with a big brightness gap but a similar hue can pass comfortably. WCAG chose luminance because readability depends primarily on being able to distinguish text from its background by brightness, which matters even for viewers with certain color vision deficiencies.
Why is green weighted so much more heavily than blue in the luminance formula?
Human vision is far more sensitive to green light than to blue light at equal physical intensity, a property of the eye's cone cells rather than anything about the colors themselves. The WCAG luminance formula's weights — roughly 71% green, 21% red, and 7% blue — reflect that sensitivity difference, so changing the blue channel moves the contrast ratio much less than an equivalent change to the green channel.
Why does swapping which color is the foreground and which is the background not change the ratio?
The formula always divides the lighter color's luminance by the darker color's luminance, regardless of which one you labeled as foreground or background, so the calculation is symmetric by design. This matches how contrast actually works visually — light text on a dark background and dark text on the same light background produce identical readability, and identical ratios.
Why does large text get a lower contrast requirement than normal text?
Larger characters have more surface area and more distinct strokes, which makes them legible at a lower brightness difference from the background than small text needs to remain readable. The W3C's WCAG 2.1 Success Criterion 1.4.3 reflects that by setting a 3:1 minimum (AA) for text at 18pt or larger — or 14pt bold — compared to the 4.5:1 minimum required for standard body-text sizes; SC 1.4.6 raises both bars further, to 4.5:1 and 7:1, at the stricter AAA conformance level.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Color Palette Generator
Generate harmonious limited color palettes from a base color.
Graphic DesignColor Mode Converter
Convert RGB color values to CMYK and HSL representations.
Accessibility & ADAWCAG Compliance Calculator
Score your website's WCAG 2.1 compliance across contrast, alt text, keyboard navigation, and ARIA labels.
Accessibility & ADAColor Blindness Check
Approximate RGB shifts for protanopia, deuteranopia, and tritanopia (Brettel-style simplification).
Graphic DesignBleed & Trim Calculator
Calculate document dimensions including bleed, trim, and safe area margins.
More in Creative, Media & Design.