Contrast Calculator
Check contrast between text and background according to WCAG standards and find accessible alternatives.
Suggestions that pass the target ratio
Contrast: 20.38
Example: Read this easily
Contrast: 21.00
Example: Read this easily
Contrast: 19.80
Example: Read this easily
Contrast: 19.17
Example: Read this easily
Contrast: 18.42
Example: Read this easily
Contrast: 16.48
Example: Read this easily
Contrast: 14.55
Example: Read this easily
Contrast: 13.58
Example: Read this easily
Contrast: 10.86
Example: Read this easily
Contrast: 7.81
Example: Read this easily
Contrast: 17.40
Example: Read this easily
Contrast: 12.63
Example: Read this easily
About: Contrast Calculator
The contrast calculator measures the ratio between a text color and a background color using the WCAG formula, and tells you whether the pair passes AA and AAA for normal text, large text and UI components. It's built for designers and front-end developers checking the accessibility of a brand palette, a button or a dark theme. When the contrast falls short, it suggests nearby colors that reach the ratio you're aiming for.
Features
- Live contrast ratio with pass or fail badges for AA, AAA, large text and UI components (3:1).
- Preview in your colors: 16 px body text, large bold text and an action button, with text you can edit.
- Up to 12 nearby colors that meet the target ratio (3, 4.5 or 7), adjusting either the text or the background.
- Enter colors as HEX,
rgb()or CSS names, use the visual picker, and swap text and background in one click. - Undo and redo (
Ctrl+Z,Ctrl+Shift+Z); both colors live in the URL, so the link reopens the same pair.
How to use it
- Enter the text color and the background color as HEX,
rgb()or with the picker. - Read the ratio and check the AA and AAA badges that match your use case.
- If the contrast is too low, pick a target ratio and choose whether to adjust the text or the background.
- Click Apply on a suggestion, or copy its HEX code.
Questions about usage
Success criterion 1.4.3 (AA) requires at least 4.5:1 for normal text and 3:1 for large text, meaning 18 pt (24 px) and up, or 14 pt (about 18.7 px) bold. Meaningful UI components and graphics need 3:1 under criterion 1.4.11.
AAA is the enhanced level (criterion 1.4.6): 7:1 for normal text and 4.5:1 for large text. Most regulations and accessibility audits target AA, while AAA is usually reserved for long-form reading or content aimed at people with low vision.
Each color's relative luminance is computed from its linearized sRGB channels, then the ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color's luminance. Results range from 1:1 for identical colors to 21:1 for black on white.