How contrast ratio works
Contrast ratio compares the relative luminance of two colors on a scale from 1:1 (identical) to 21:1 (black on white). The Web Content Accessibility Guidelines (WCAG 2) use it to decide whether text is readable for people with low vision or color vision deficiencies, and on dim or glaring screens. Hue does not count — only how light or dark the two colors are.
WCAG AA and AAA thresholds
- Normal text: at least 4.5:1 for AA and 7:1 for AAA.
- Large text (24px and up, or 18.66px bold and up): 3:1 for AA and 4.5:1 for AAA.
- UI components and graphics such as icons, input borders and focus rings: 3:1 (WCAG 1.4.11).
Ratios are rounded down to two decimals, so 4.499:1 shows as 4.49:1 and fails AA — the same way strict audit tools treat it.
Fixing a failing pair
When a pair fails, the checker searches for the nearest color that passes by changing only lightness in OKLCH, once for the text and once for the background. Hue and saturation stay the same, so the fix still looks like your brand. Share the exact pair with the link in the address bar. For full color schemes with text, background and accent roles already balanced for contrast, try the palette generator or browsecolor palettes.