Color contrast checker (WCAG 2.2)

Enter or pick a text color and a background color. The checker calculates the relative luminance of both colors and the contrast ratio exactly as defined by the W3C and shows which WCAG 2.2 success criteria are met. If the contrast falls short, it suggests the nearest text color that passes.

HEX, rgb(), hsl() … – transparency works too
Your inputs are saved in this browser only.

Preview

Normal text: this is how a paragraph reads at a 16-pixel font size.

Large text from 24 px

Bold text from 18.67 px

Button

Preview in your colors: 16 px regular, 24 px regular and 18.67 px bold (= 14 pt bold, large text), followed by a border and an icon as a UI example.

Result

Contrast ratio
4.48 : 1
WCAG 2.2 rating
CriterionMinimumResult
Normal text – AA (SC 1.4.3)4.5 : 1✗ fail
Normal text – AAA (SC 1.4.6)7 : 1✗ fail
Large text – AA (SC 1.4.3)3 : 1✓ pass
Large text – AAA (SC 1.4.6)4.5 : 1✗ fail
UI components and graphics – AA (SC 1.4.11)3 : 1✓ pass
Nearest text color for AA (4.5:1)
#767676 (4.54 : 1)
Nearest text color for AAA (7:1)
#595959 (7.00 : 1)
Relative luminance, text color
0.1845 (#777777)
Relative luminance, background
1.0000 (#FFFFFF)

How it is calculated

How contrast is calculated

WCAG 2.2 defines the contrast ratio as (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 that of the darker one. The result ranges from 1:1 (identical colors) to 21:1 (black on white).

The checker calculates relative luminance exactly as the W3C defines it: each sRGB channel is divided by 255 and linearized – values up to 0.04045 are divided by 12.92, higher values become ((value + 0.055) ÷ 1.055)2.4. Then L = 0.2126 × R + 0.7152 × G + 0.0722 × B.

Example #777777 on white: 0x77 = 119, 119 ÷ 255 = 0.4667 → ((0.4667 + 0.055) ÷ 1.055)2.4 = 0.1845. Since all three channels are equal, L = 0.1845. White has L = 1. Contrast = (1 + 0.05) ÷ (0.1845 + 0.05) = 4.48:1. That is enough for large text (3:1) but just misses the mark for normal text (4.5:1). The suggested #767676 reaches 4.54:1.

WCAG 2.2 requirements

Success criterionLevelNormal textLarge text
1.4.3 Contrast (Minimum)AA4.5:13:1
1.4.6 Contrast (Enhanced)AAA7:14.5:1
1.4.11 Non-text Contrast (UI components, graphics)AA3:1

Under WCAG, large text is at least 18 point, or at least 14 point bold – in a browser that is roughly 24 px and 18.67 px. Exceptions include logos, purely decorative text and inactive controls.

No rounding

WCAG compares the exact value: 4.499:1 does not meet 4.5:1. The checker therefore rates the unrounded ratio and displays two decimal places; where rounding would appear to reach a threshold, it truncates instead (4.49 rather than 4.50).

Transparent colors

Colors with an alpha value (e.g. rgba(0, 0, 0, 0.6) or #00000099) are layered the way a browser draws them: a transparent background on white, a transparent text color on the background. If your page sits on a different backdrop, enter that opaque color as the background.

Frequently asked questions

What contrast ratio does accessibility require?

At least 4.5:1 for normal text (WCAG level AA, SC 1.4.3) and 3:1 for large text. The stricter level AAA requires 7:1 and 4.5:1 respectively. Controls such as input borders and icons need 3:1 (SC 1.4.11).

Which grays on white still pass AA?

#767676 is the lightest gray with at least 4.5:1 on white (4.54:1). #777777 falls just short at 4.48:1.

How does the checker find the suggested color?

It keeps the hue and saturation of your text color and changes only the HSL lightness in small steps, both lighter and darker. It suggests the smallest change whose rounded color safely reaches the target.

Which accessibility laws refer to these contrast values?

In the US, the Section 508 standards for federal agencies incorporate WCAG 2.0 level AA, and the ADA Title II rule for state and local governments adopts WCAG 2.1 AA. In the EU, the European Accessibility Act points via the harmonized standard EN 301 549 to WCAG 2.1 AA. The contrast criteria are the same in WCAG 2.0, 2.1 and 2.2: 4.5:1 for text, 3:1 for large text – plus 3:1 for UI components from WCAG 2.1 onward.

Sources and legal basis

As of:

Related tools