What the checker tests
WCAG 2.2 has three main contrast success criteria. Each compares the contrast ratio of two colors with a minimum, and this tool tests all of them at once.
| Success criterion | Applies to | Minimum |
|---|---|---|
| 1.4.3 Contrast (Minimum), level AA | Normal text | 4.5:1 |
| 1.4.3 Contrast (Minimum), level AA | Large text | 3:1 |
| 1.4.6 Contrast (Enhanced), level AAA | Normal text | 7:1 |
| 1.4.6 Contrast (Enhanced), level AAA | Large text | 4.5:1 |
| 1.4.11 Non-text Contrast, level AA | UI components and meaningful graphics | 3:1 |
Large text is at least 18 point, or at least 14 point if bold. At 1pt = 1.333px that is about 24px, or about 18.67px bold (the W3C Understanding document rounds this to about 18.5px). Logos, incidental text and inactive controls are exempt.
How the ratio is calculated
Each color is converted to relative luminance: the sRGB channels are linearized and weighted 0.2126 red, 0.7152 green and 0.0722 blue. The ratio is (L1 + 0.05) ÷ (L2 + 0.05), with L1 the lighter color. It runs from 1:1 for two identical colors to 21:1 for black on white.
Rounding
The WCAG Understanding documents say the thresholds are exact and the computed value should not be rounded: 4.499:1 does not meet 4.5:1. This tool compares the unrounded ratio, shows it to four decimals under the main figure, and never displays a failing value rounded up onto a threshold. For example, #777777 on white is 4.4781:1 and shows as 4.48, a fail for AA normal text, while #767676 is 4.5422:1 and passes.
Transparent colors
A see-through text color has no contrast of its own: what the reader sees is the text color mixed with what is behind it. When the text color has an alpha value below 1, the tool blends it over the background first (the same source-over mix browsers use) and checks the result. A transparent background is first placed over white. For example, rgba(17, 24, 39, 0.6) over white is seen as #70747d, which gives 4.68:1. The same color fully opaque, #111827, gives 17.74:1.
How the suggested fixes work
When a level fails, the tool looks for the closest color that passes by changing only one property: OKLCH lightness. Hue and chroma stay the same, so a brand blue stays the same blue, just lighter or darker. It searches both lighter and darker, keeps whichever passes with the smaller change, and converts the result back to sRGB with the CSS Color 4 gamut mapping (which lowers chroma only if the color would fall outside sRGB). It does this for the text color and, separately, for the background.
Worked example
White text on a #3b82f6 button gives 3.68:1. That passes AA large text and the 3:1 check for UI components, but fails AA normal text, AAA normal text and AAA large text.
- White cannot get lighter, so the only text fix is to go dark: the nearest passing text color for AA is
#1e1e1eat 4.53:1, and no text color reaches 7:1 on this blue. Keeping white text means changing the background. - For AA, the nearest passing background is
#2c72e5at 4.52:1. Its OKLCH lightness drops from 62.31% to 57.34%, while hue and chroma stay at about 260 and 0.188. - For AAA, the nearest is
#0452c2at 7.02:1, at 47.19% lightness.
A gray example: #999999 on white is 2.85:1 and fails everything. The nearest passing text grays are #949494 (3.03:1), #767676 (4.54:1) and #595959 (7.00:1).
Common mistakes
- Treating large text loosely. 18px regular text is not large text. Only 24px and up, or about 18.67px and up in bold, gets the lower 3:1 and 4.5:1 minimums.
- Checking text but not controls. Focus indicators, and any border, icon or chart line needed to identify a control or understand a graphic, need 3:1 against the colors next to them under 1.4.11.
- Ignoring opacity. Gray text made with
opacityor an alpha color is lighter than its CSS value suggests. Check the blended color. - Testing one state only. Hover, focus, visited, disabled and placeholder colors each have their own contrast. Disabled controls are exempt; placeholder text is not.