ποΈ Color Contrast Checker β WCAG Ratio
Enter a foreground and background hex color. The checker computes the WCAG relative-luminance ratio and marks AA and AAA thresholds.
What this tool does
The contrast checker computes the WCAG relative-luminance ratio between a foreground and background colour. It reports the numeric ratio and marks whether the pair passes the AA and AAA thresholds for normal and large text.
It accepts three- and six-digit hex values and expands short forms automatically. Designers and developers use it to catch low-contrast labels, muted text and button states before they become accessibility bugs.
When to use it
- Checking body text against a page background before launch.
- Validating button and link colours in a design system.
- Choosing a darker grey that still passes AA on white.
- Reviewing a client palette for accessibility risks.
How it works
- Enter two colors as #RGB or #RRGGBB.
- Press Check contrast. Relative luminance follows the WCAG 2 formula.
- Compare the ratio with 4.5:1 and 3:1 for AA, and 7:1 and 4.5:1 for AAA.
Worked example
With foreground #1A1A1A and background #FFFFFF, the ratio is about 17.4:1, which passes AAA for normal text. Trying #777777 on white produces roughly 4.48:1, just below the 4.5:1 AA threshold for normal text, so a slightly darker grey is needed.
- #1A1A1A on #FFFFFF is a high-contrast pair that passes AAA for normal text.
- #777777 on #FFFFFF is a common mid-gray that often fails AA for normal text.
- Short #RGB values such as #FFF are expanded before the ratio is calculated.
Accuracy and limitations
- The calculation follows the WCAG 2 relative-luminance formula for opaque sRGB hex colours. Alpha transparency and colour spaces such as P3 are not modelled.
- The result is a static pair test, not a full audit of focus indicators, gradients, images or hover states.
- Passing a ratio does not guarantee readability for every user; font size, weight and rendering still matter.
Privacy and data handling
Contrast is computed in JavaScript from the hex values you enter. No colour values are transmitted or stored.
Frequently asked questions
What ratio is required for WCAG AA?
Normal text needs at least 4.5:1. Large text and non-text UI components need at least 3:1. AAA raises normal text to 7:1 and large text to 4.5:1.
Does this check alpha transparency?
No. Only opaque hex colors are compared. Flatten transparent colors onto the real background before checking.
Is this an official audit?
It applies the published WCAG contrast formula for a quick check. It is not a substitute for a full accessibility review of a page.
What ratio do I need for normal text?
WCAG AA requires 4.5:1 for normal text and 3:1 for large text. AAA raises those to 7:1 and 4.5:1.
Does it check link colours and focus rings?
No. Check each foreground/background pair separately, including UI component boundaries, which have their own 3:1 requirement.
Related tools
More Design tools βHSL to Hex Converter
Convert between HSL and hexadecimal color formats privately.
Aspect Ratio Calculator
Solve width, height and simplified aspect ratios without breaking proportions.
CSS Gradient Generator
Generate CSS linear and radial gradients with live preview and copy-ready code.
Color Palette Generator
Generate five hex tints and shades from a single base color.