How to use the contrast checker
- Set the text and background colors, or press Swap colors to test the reverse.
- Set the font size and weight. They decide whether the large-text rules apply.
- Type your own sample text to see it in place.
- Read the results: the ratio, AA and AAA for normal and large text, and 3:1 for UI elements.
- If it fails, press Use nearest passing color.
- Export a text report for your team, or the colors as CSS variables.
How the ratio is calculated
WCAG converts each color to relative luminance (how bright it appears) and compares them: (lighter + 0.05) / (darker + 0.05). The result ranges from 1:1 (identical colors) to 21:1 (black on white).
Worked examples
Example 1: grey body text
Load Grey on white: slate #64748B on white is about 4.8:1, so it passes AA for normal text. Lighter greys like #9CA3AF fail at about 2.5:1. Use the suggestion to find the lightest grey that still passes.
Example 2: white text on an orange button
Load White on orange. Bright orange with white text usually fails even for large bold text. Either darken the orange or switch to dark text on the button.
Example 3: dark mode secondary text
Load Dark mode muted. Mid-grey #6B7280 on #111827 looks fine on a good screen but falls below 4.5:1. Brighten it until it passes.
Common mistakes
- Testing on a perfect monitor. People use phones in sunlight and older screens; the minimums exist for them.
- Relying on color alone. Links, errors and statuses need underlines, icons or text too.
- Checking only text. Input borders, icons and focus rings need 3:1 as well.
Testing beyond the numbers
Contrast ratios are a strong starting point, but real conditions vary. Check important pages on a phone outdoors, with night mode on, and with your operating system’s high-contrast setting. Ask whether thin fonts, small sizes or busy backgrounds make text harder to read than the ratio suggests, and adjust before you ship.