Check whether two colours have enough contrast
Pick a text colour and a background colour. The tool shows their contrast ratio, and whether it passes WCAG AA (4.5:1) and AAA (7:1) for body text. If it fails, the tool suggests a lighter or darker version of your text colour that passes. If there isn't one, it says so and offers black or white, with the ratio it reaches.
How to check a text colour against its background
The tool checks one pair at a time: the colour of your text and the colour behind it. If you are choosing colours for a brand or an interface, check each pair you plan to use.
-
Choose your two colours
Pick a text colour and a background colour, or type their hex codes.
-
Read the contrast results
See the contrast ratio, and a pass or fail for AA and AAA. Both come from WCAG, the Web Content Accessibility Guidelines.
-
Use a suggested colour
If AA or AAA fails, you can apply the colour suggested for it, and the result updates.
True-Contrast Smart Palette
Pick a foreground (text) colour and a background colour below. You get the exact contrast ratio straight away, PASS or FAIL badges for WCAG AA and AAA, a live preview, and if either level fails, a fix that genuinely keeps the same hue wherever one exists at that lightness.
WCAG 2.1 defines two relevant thresholds for normal body text: AA needs a contrast ratio of at least 4.5:1, AAA needs at least 7:1. Larger text has lower thresholds, but this tool always checks the stricter body text targets.
Contrast ratio is calculated from the relative luminance of each colour, exactly as WCAG 2.1 publishes the formula. No colour is silently rounded away: an invalid hex shows a message right next to the field instead of freezing your last result.
Result
Contrast ratio: -
The quick brown fox jumps over the lazy dog. This sample shows your chosen text colour on your chosen background.
Suggested fixes
Each suggestion below keeps your original hue and saturation and searches only lightness for the smallest change that reaches the target. If no lightness of that hue reaches the target on this background, the card falls back to pure black or white and says so. A card only appears for a level that is actually failing.
Fix for AA (4.5:1)
Suggested hex: -
Actual ratio: -
Fix for AAA (7:1)
Suggested hex: -
Actual ratio: -
Check the contrast of two colours
It checks a foreground and a background colour against WCAG contrast thresholds and shows where the pair fails. It takes solid colours only, so check text over a translucent colour, a gradient or a photograph on the finished page.
No account required · Free to use · Works in any browser
Popular Tools
CSS Variable Architect
An interactive CSS Variable Architect, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Variable Architect
True-Contrast Smart Palette
An interactive True-Contrast Smart Palette, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / True-Contrast Smart Palette
CSS Unit Converter (px / rem / em / vw / vh)
An interactive CSS Unit Converter (px / rem / em / vw / vh), free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Unit Converter (px / rem / em / vw / vh)
Aspect Ratio Calculator
An interactive Aspect Ratio Calculator, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / Aspect Ratio Calculator
CSS Grid Architect
An interactive CSS Grid Architect, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Grid Architect
CSS Specificity Calculator
An interactive CSS Specificity Calculator, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Specificity Calculator