Skip to content

Color Contrast Ratio Calculator

Free

Calculate the exact contrast ratio between any two colors. Instant WCAG AA and AAA results. Free, browser-based, no signup.

contrast ratio checkercalculate color contrastaccessibility color ratio
All Color Tools

Settings guide

Interpreting contrast ratios:

RatioInterpretation
1:1No contrast (identical colors)
2:1Very low — text essentially invisible
3:1Minimum for large text or UI components (WCAG AA)
4.5:1Minimum for normal body text (WCAG AA)
7:1Enhanced — WCAG AAA for body text
21:1Maximum — black text on white background

Colors that commonly fail 4.5:1 on white (#FFFFFF):

  • ·Medium gray #808080 → 3.95:1 (Fail)
  • ·Brand red #FF0000 → 4.0:1 (Fail — surprising)
  • ·Pure green #00FF00 → 1.37:1 (Fail dramatically)
  • ·Medium blue #0000FF → 8.59:1 (Pass — blue on white works)
  • ·Medium orange #FF8800 → 2.94:1 (Fail)

Testing both directions: Always test foreground-on-background AND background-on-foreground for interactive elements that can be in different states.

Format comparison

Contrast ratio vs luminance difference: The luminance formula is not the same as the simple mathematical difference between color values. RGB(128,128,128) gray has a relative luminance of 0.216, not 0.5. The eye perceives mid-gray as much darker than the mathematical midpoint because human brightness perception is non-linear (gamma-encoded).

WCAG 2.1 ratio vs APCA score: WCAG 3.0 will use the APCA (Advanced Perceptual Contrast Algorithm) which produces an Lc (Lightness Contrast) score instead of a ratio. APCA accounts for font size and weight — small text requires higher contrast than large text. WCAG 2.1 applies the same threshold regardless of font size above/below the 18/14px line. Until WCAG 3.0 is finalized, the 4.5:1 ratio remains the legal standard.

Contrast for dark themes: The same ratio thresholds apply. A dark theme with light text still needs 4.5:1 for body text. Light text (say, #E5E7EB) on a dark background (#1F2937) achieves approximately 13:1 — well above AAA. Problems arise when designers use muted colors for secondary text on dark backgrounds, dropping below 4.5:1.

How it works

1

Enter two colors

Input any color in HEX, RGB, or HSL format for both foreground and background.

2

Calculate

The relative luminance of each color is computed using the WCAG sRGB formula, then the ratio is derived.

3

Read and act

See the exact ratio and pass/fail status for AA and AAA. Adjust colors until you reach compliance.

About this format

The contrast ratio between two colors is a precise mathematical measure of how visually distinct they are from each other. It is the single most important accessibility metric for digital color — the number that determines whether text is readable, whether buttons are visible, and whether your interface meets legal accessibility standards.

The ratio runs from 1:1 (identical colors — zero contrast) to 21:1 (black on white — maximum possible contrast). WCAG 2.1 requires at least 4.5:1 for standard body text against its background, and 3:1 for large text or UI component boundaries. AAA compliance requires 7:1 for body text.

The formula uses relative luminance — a linear measure of how much light each color emits or reflects, accounting for how the human eye's sensitivity varies across the spectrum (we perceive green as brighter than blue at the same intensity). The luminance of both colors is calculated, and the ratio is (brighter + 0.05) / (darker + 0.05).

Frequently asked questions

How is the contrast ratio calculated?+
Using WCAG relative luminance: each RGB channel is linearized (gamma-corrected), then combined as 0.2126R + 0.7152G + 0.0722B. The ratio is (L1 + 0.05) / (L2 + 0.05) where L1 is the lighter luminance. The +0.05 prevents a division-by-zero for pure black and reflects the ambient viewing conditions in the standard.
Why does pure red (#FF0000) fail contrast on white?+
Red has a relative luminance of 0.2126 (based on how the human eye perceives red vs green vs blue). The contrast ratio of pure red on white is approximately 4.0:1 — just below the 4.5:1 AA threshold. Darkening the red slightly (e.g., #CC0000 = 5.09:1) achieves compliance.
Why does pure green (#00FF00) have such poor contrast on white?+
Counterintuitively, bright green appears very similar in luminance to white because the human eye is most sensitive to green wavelengths. Lime green (#00FF00) has a luminance of 0.7152 — very close to white at 1.0. Their contrast ratio is only 1.37:1, making green-on-white text nearly unreadable.
Can I check contrast for semi-transparent colors?+
Contrast is always calculated between final rendered colors — what the pixel actually looks like on screen. For transparent colors, you need to calculate the blended color first (the overlay composited onto its background), then measure the contrast of that composite against the text or element color.
What is the contrast ratio of black on white?+
21:1 — the maximum possible contrast ratio. Black (#000000) has a luminance of 0, white (#FFFFFF) has a luminance of 1. The formula gives (1.05) / (0.05) = 21. Any ratio below 21:1 means some information is being lost relative to maximum legibility.

Related tools and guides