Color Contrast Checker
Check text contrast against WCAG AA and AAA levels.
How to use
- Pick the foreground (text) and background colors with the color controls, or type HEX values directly.
- The ratio is computed live with the WCAG formula (a value between 1 and 21).
- Read the verdict table: the four AA/AAA rows for normal and large text are marked green "Pass" or red "Fail".
- The sample preview renders normal and large text in your colors so you can judge readability at a glance.
- Curious about the inverted pairing? Hit "Swap foreground / background" to exchange the two colors instantly.
FAQ
How is the contrast ratio calculated?
What is the difference between AA and AAA?
What counts as "large text"?
The ratio passes but reading still feels hard: what else can I do?
How to use
- Enter both colors
Set the foreground (text) and background with the color pickers or by typing 3- or 6-digit HEX values. Results update as you type.
- Read the contrast ratio
The ratio appears live and always falls between 1 and 21. Higher means clearer text. It comes from the WCAG relative-luminance formula.
- Check the four verdicts
Compare the four rows. Normal text needs AA at 4.5 and AAA at 7. Large text needs AA at 3 and AAA at 4.5. Each row is marked green Pass or red Fail.
- Preview and swap
The sample preview renders normal and large text in your colors; press Swap foreground / background to test the inverted pairing instantly.
About this tool
Color Contrast Checker measures how distinguishable your text is from its background using the WCAG 2.x relative-luminance formula. Each hex color is linearized and weighted (red 0.2126, green 0.7152, blue 0.0722) into a luminance L. The ratio divides the lighter luminance plus 0.05 by the darker plus 0.05, producing a value from 1 to 21. The verdicts map onto WCAG levels: AA is the baseline most accessibility laws and audits demand, AAA is the stricter enhanced tier.
Use it before signing off buttons, placeholders and gray-on-white body text, or as the self-check step of an accessibility audit. Remember what the number does not cover. Contrast measures luminance difference only. Letter spacing, line height and the typeface itself sit outside the formula. For comfortable long-form reading aim beyond the minimum, around 7:1, and avoid the harsh pure-black-on-pure-white combination.
How it works
The 0.05 offset in (L1+0.05)/(L2+0.05) is deliberate. It makes pure black against pure white exactly 21, and it keeps the denominator from reaching zero when black is the background. Before any of that, each sRGB channel is gamma-expanded and weighted: red 0.2126, green 0.7152, blue 0.0722. The weights mirror how strongly human vision responds to green. That is why the computed number usually agrees with the eyes.
The thresholds trace back to readability research. Low-vision readers supplied the baseline data, and the 3:1 level doubles as the WCAG requirement for graphical objects and control borders, criterion 1.4.11. Large text means 24px regular or 18.66px bold and above, with looser thresholds of 3 and 4.5. The newer APCA model grades text more finely by weight and color. Accessibility laws around the world still enforce the classic ratio, though. AA at 4.5 and AAA at 7 remain the numbers that auditors and legal teams will hold you to for the foreseeable future.
When to use it
- Placeholder gray audit
Input hints are usually a #999-class gray, barely 2.8:1 on white. Darken one step toward #767676 to clear 4.5. This single check is the most common miss on polished forms.
- Acceptance for chart palettes
Pair every series color with the chart background before shipping. Anything under 3:1 is hard to tell apart, so rotate the hue or stretch the lightness gap and re-test.
- Grading grays in email templates
Email clients render unpredictably and offer little style fallback. Test body copy, secondary notes and the copyright line separately, so the palest tier still clears AA.
Tips & tricks
- Large text means 24px regular weight or 18.66px bold and above; its thresholds loosen to 3:1 and 4.5:1.
- If the ratio passes but reading feels hard, increase font size and line height, or soften pure white backgrounds.
- Test hover and disabled button states too. They are the pairings most often missed, and they easily drop below 3:1.
Things to watch
- Composite translucent colors first
Text at 60% opacity renders as a blend with the background, not as the color you set. Convert it to the equivalent solid HEX before testing, or the ratio will overstate real readability.
- Test both ends of a gradient
On a gradient background the ratio shifts continuously, so one measurement cannot cover the whole surface. Measure the darkest and lightest ends; both must pass before any position on the banner is safe.
- Split brand colors by tier
A bright brand color on dark often lands between 3 and 4.5. Keep it for large headlines that qualify for the 3:1 tier, and move body text to neutral colors.