How to use it
- Enter the text colour and the background colour, or pick them with the colour pickers.
- Read the ratio and the pass or fail for each criterion; the preview shows the pair.
- If a level fails, see the nearest text or background colour that reaches it.
- Select “Use” to try a suggested colour, or copy its code.
Rules and limits
How the ratio is worked out
- By the WCAG 2.2 definitions: each sRGB channel is linearised (values up to 0.04045 divided by 12.92, others ((v + 0.055) / 1.055)^2.4), relative luminance L = 0.2126 × R + 0.7152 × G + 0.0722 × B, and the ratio (L1 + 0.05) / (L2 + 0.05) with the lighter colour as L1.
- Minimums: 4.5:1 for normal text and 3:1 for large text (AA, success criterion 1.4.3), 7:1 and 4.5:1 (AAA, 1.4.6), 3:1 for icons, borders and focus indicators (1.4.11). They are compared without rounding; a ratio is shown with two decimals, or three when two would make a failing ratio look like a pass.
- A partly transparent text colour is drawn over the background first, a partly transparent background over white, as a browser would show them.
- Checked: 5,000 random colour pairs and 500 HSL colours give the same ratio as a separate Python implementation; #777777 on white gives 4.48:1.
The suggested colours
- For each level that fails (4.5:1, 7:1, 3:1), the page looks for the nearest text colour and the nearest background colour that reach it: only the lightness changes (in the OKLCH colour space), the hue stays, and the colour is checked again after rounding to whole sRGB values.
- When even black or white cannot reach a level against the other colour, no suggestion is shown for that side.
Questions and answers
What counts as large text?
WCAG calls text large from 18 point (24 CSS pixels) or 14 point bold (about 18.7 pixels bold). Large text needs 3:1 for AA and 4.5:1 for AAA, normal text 4.5:1 and 7:1.
Why does 4.48:1 fail when it is so close to 4.5:1?
WCAG sets the minimum without rounding: the ratio must reach 4.5 exactly. That is why grey #777777 on white fails and #767676 passes.
Is a passing ratio enough for readable text?
It is the minimum the guidelines can measure. Thin fonts, small sizes, text over pictures and colour-blind readers can still need more; the preview helps you judge.
Are the colours sent anywhere?
No. The ratio is worked out in your browser; the page sends nothing. The two colours are kept only in this tab, like the options of the other tools.