How to use this tool
- Enter a foreground text color and a background color.
- Check the ratio and WCAG AA / AAA status.
- Use the preview and copy CSS into your component or design notes.
Check foreground and background colors against common WCAG contrast thresholds. Preview the pair, copy CSS, and quickly decide whether a button, card, form label, or documentation page has enough readable contrast.
Input: foreground #111827, background #ffffff
Output: ratio 17.74:1, AA normal pass, AAA normal pass.
| Issue | Why it happens | How to fix it |
|---|---|---|
| Muted text fails AA | The foreground is too close to the panel or page background. | Darken the text on light backgrounds or lighten it on dark backgrounds. |
| Brand color button fails | Bright brand colors often need dark text instead of white text. | Try swapping text to near-black, or choose a deeper brand shade. |
| Hex value is rejected | The input is not a 3-digit or 6-digit hex color. | Use values like #fff, #ffffff, or 111827. |
Use the ratio as a design debugging signal, then change the color pair in the component where the text actually appears.
4.5:1 for AA. Darken the text, lighten the background, or pick a less saturated brand shade.3:1 for AA when the text is large enough. Do not assume font weight alone changes the measured ratio.| Edge case | Expected behavior |
|---|---|
| Large text | Large text has a lower AA threshold than normal body text. |
| Transparent backgrounds | This tool checks solid color pairs. Composite transparency against the final background first. |
| Gradients and images | Check the worst-case sampled background color behind the text. |
After checking contrast, use the Box Shadow Generator to tune card elevation without hurting readability. If your color tokens live in JSON, use the JSON Formatter. For CSS or log patterns in QA notes, use the Regex Tester.
No. The ratio is calculated locally in your browser from the colors you enter.
Common WCAG AA guidance uses at least 4.5:1 for normal text and 3:1 for large text.
It checks solid pairs. For gradients or images, sample the weakest background color behind the text and test that pair.