Gradient Text Contrast Checker
Contrast checkers built for one solid background cannot judge text over a gradient, where the ratio changes from one end to the other. This tool takes a two-color gradient (start color, end color, angle) and a text color, and checks the ratio at every distinct color the gradient paints. It reports the lowest ratio with the position where it occurs, shows AA and AAA as pass, borderline or fail for the text size you choose, previews the text, and gives you the CSS. If the gradient does not pass AA, it finds the smallest black overlay, in whole percents up to 80%, that does.
How to Check Contrast Over a Gradient
- Set the gradient - Pick Gradient start and Gradient end with the color pickers or hex fields, and drag Gradient angle to match your design.
- Set the text - Choose the Text color and a Text size. Large means 24px, or 18.67px bold; anything smaller is normal.
- Read the worst case - The big number is the lowest contrast anywhere along the gradient, and the line under it says where. It is shown rounded down, so it never reads higher than the exact ratio.
- Check AA and AAA - Each box says pass, borderline or fail against that level's minimum for the chosen text size. Borderline means the exact ratio meets it but would not with a one color step error, so it may fail on screen.
- Fix a failure - When AA is not a full pass, the tool shows the Minimum overlay to pass AA. Press Apply, or tick Add dark overlay and set Overlay opacity yourself, then press Copy to get the CSS, with the overlay as a second background layer.
Why the worst point decides
WCAG requires 4.5:1 for normal text and 3:1 for large text wherever the text sits, not on average. Over a gradient the ratio varies smoothly, so the lowest point is the one that counts, and it is often not the middle. With light text it is the lightest part of the gradient; with dark text it is the darkest part. When the text color falls between the gradient's lightest and darkest parts, the worst point can be anywhere in the interior.
The tool measures the gradient as the CSS specifies it. It interpolates hex colors in sRGB like a CSS linear-gradient(), rounds each channel to a whole number from 0 to 255, and applies the WCAG relative luminance formula to every distinct color that results. Pass and fail use the exact ratio: #006ffb on white is 4.4999:1, shows as 4.49:1 and fails AA. A black overlay is composited over each of those colors, which matches an overlay layer placed above the gradient in the same background.
Browsers dither gradients by about one color step per channel, so painted pixels can differ slightly from that model, and a ratio just above a threshold can dip below it on screen. A pass here therefore has to hold with every gradient color off by one step in either direction; anything that meets the level only exactly is marked borderline, not pass. Limits: only two evenly spaced opaque stops, with no color hints or extra stops. The whole gradient is measured, not just the part behind your text, so it can be stricter than your layout. The overlay can only darken, so it helps light text and cannot help dark text. It does not judge text over photos.