A11yvanto.online Request an Accessibility Audit

Free tool

Contrast Checker

Enter two colours as hex codes to see their contrast ratio and whether they meet the WCAG minimums. It works in your browser and sends nothing anywhere.

Hex code, for example #18203a
Hex code, for example #ffffff

Sample heading text

Sample body text at normal size, so you can judge readability as well as the number.

Contrast ratio

?

Normal text, AA (4.5 to 1): ?
Large text, AA (3 to 1): ?
Interface parts (3 to 1): ?
Normal text, AAA (7 to 1): ?

How the checker works

The checker uses the formula WCAG defines for contrast. Each colour is converted to its relative luminance, a measure of how light it appears, with red, green and blue weighted to match human vision. Then 0.05 is added to both luminance values and the larger sum is divided by the smaller one. The result runs from 1 to 1 for identical colours to 21 to 1 for black on white. The ratio shown is rounded down to two decimal places, so a pair is never shown as passing when it falls just short.

The thresholds come from WCAG 2.2: a ratio of 4.5 to 1 for ordinary body copy, relaxed to 3 to 1 once text is large, under 1.4.3 Contrast (Minimum), and at least 3 to 1 for interface components and meaningful graphics under 1.4.11 Non-text Contrast.[1] Large text means at least 18 point, or 14 point bold.[1]

Tips for accurate results

  • Use the exact values from your CSS or design file, not colours picked from a screenshot.
  • Check every state: normal, hover, focus, visited and disabled.
  • For text on a gradient or image, check the lightest part of the area behind the text.
  • For semi-transparent colours, work out the final colour on its background first; this checker expects solid colours.

Using the result

If a pair fails, change one colour at a time. Darkening text on a light background, or lightening it on a dark one, is usually the smallest change, and often barely visible to people who do not need it. Record the passing values in your design system so the same pair is not chosen again. If a brand colour has to stay as it is, keep it for large headings, borders or backgrounds and use a darker shade of it for body text and links.

For a full explanation of the rules and how to fix a failing palette, read our guide to colour contrast.

Sources

Sources checked on 3 November 2026.

  1. Standard. Web Content Accessibility Guidelines (WCAG) 2.2, W3C, W3C Recommendation, 12 December 2024 edition.