Which point along the blend breaks your text? Two to eight stops in linear, radial or conic form, with contrast measured at every whole percent and a solid fallback written in.
CSS linear gradient at 90 degrees
Which point along the blend breaks your text? Two to eight stops in linear, radial or conic form, with contrast measured at every whole percent and a solid fallback written in.
In CSS zero degrees points up and the angle turns clockwise, so 90 degrees is not where most drawing tools would put it. The declaration below is ready to copy, complete with the solid background colour that catches the case where the gradient image never paints. The contrast table measures white text against the blend at every whole percent, which is the check that catches a heading going invisible halfway across.
Parameters
Enter data for calculations
💡 Fill in all required fields to unlock the calculate button
Two colors, and everywhere in between
A gradient is not two colors. It is every color between them, and the ones in the middle are the ones nobody looks at. That is where a heading stops being readable, that is where a smooth blend turns muddy, and neither shows up in a preview of the two ends.
Colors go in one per line, as a hex value, an rgb() or hsl() function, or a name. Out comes a declaration with a solid fallback in front of it, a preview with sample text sitting on it, and a table saying how readable that text is at every point along the blend rather than only at the two ends.
The three shapes, and what the geometry argument means
All three take the same list of stops. What differs is the path the blend travels, and that path is set by the first argument, which is the one thing people copy from a snippet and never change.
| Shape | First argument | The blend travels | Reach for it when |
|---|---|---|---|
| Linear | 135deg | In a straight line across the box. 0deg runs bottom to top, and the angle turns clockwise from there. | Headers, buttons, cards. Nearly always the right answer. |
| Radial | ellipse at top left | Outward from a point. A circle keeps its shape, an ellipse stretches to the box. | A glow behind a subject, a spotlight, a vignette. |
| Conic | from 90deg | Around the center like a clock hand, so the last stop meets the first. | Pie shapes, progress rings, color wheels. |
The conic case has a trap built into it. Because the sweep closes the loop, a first and last stop that are different colors meet at a hard edge on the way round. Repeating the first color as the last stop is what makes a conic gradient look continuous, and it is why the worked example below reads #ef4444 at both ends.
Where a gradient goes wrong is never at the ends
Take black to yellow to black, with white text on top. Both ends are black, so both ends measure 21:1, the highest contrast that exists. Anyone checking the two colors they typed would sign this off. In the middle the background is pure yellow and the same white text measures 1.07:1, which is very close to invisible.
Ends 21.00:1, middle 1.07:1. Passes twice, fails everywhere it matters.
From 2.78:1 down to 1.93:1. Never passes, at any point, at any text size.
Worst point 6.20:1 at 26 percent. The gradient was fine, the text color was not.
From 16.20:1 to 5.17:1. Clears the bar the whole way across.
The third card is the useful one. Coral to teal is not a bad gradient. It is a bad gradient for white text, and swapping the text to a near black takes the worst point from 1.93:1 to 6.20:1 without touching either background color. That is a two second change that is invisible unless something measures the middle.
There is a second thing the middle hides. Blending happens channel by channel, so two colors sitting opposite each other pass through gray on the way. Red to green is not red, orange, green. Halfway across it is #808000, a flat olive, because the red channel has fallen to 128 while the green has only climbed to 128. Every complementary pair does this, and it is the reason a gradient that looked bright in two swatches looks washed out on the page.
What do you actually have to decide here?
- Colors - two to eight, one per line. Add a percentage after a color to pin it: #f9d423 30% puts that stop at 30 percent instead of the middle. Anything left blank is spread evenly.
- Shape - linear, radial or conic. This decides which of the two fields below applies.
- Angle - for linear and conic. Given in degrees, wrapped into range, so -45 is accepted and comes back as 315deg.
- Position and shape - for radial only. Circle or ellipse, anchored to a corner, an edge or the center.
- Text color - the color of whatever will sit on top. This is what every contrast figure is measured against, and changing it is often the fix.
- Fallback - which stop becomes the solid background-color underneath. Whichever end carries your text more safely is the one to pick.
- Read the worst point - the tile on the right of the result is the number that decides whether this ships.
Reading the contrast column
The four verdicts are thresholds, not opinions. They come from the WCAG contrast ratio, which compares the relative luminance of two colors and returns a number between 1 and 21. What changes between the rows is only which size of text the number is good enough for.
| Verdict | Ratio | What it covers | Example from the runs above |
|---|---|---|---|
| AAA | 7.00 and up | Any text size, with room to spare | White on #800080, the midpoint of red to blue: 9.42:1 |
| AA | 4.50 to 6.99 | Any text size, the usual target | White on royal blue #2563eb: 5.17:1 |
| Large text only | 3.00 to 4.49 | At least 24px, or 18.66px bold. Not body copy. | White on pure red #ff0000: 4.00:1 |
| Fails | below 3.00 | Nothing. Not headings either. | White on teal #4ecdc4: 1.93:1 |
One detail worth knowing, because it explains a number that looks off by a hair. The ratio is computed on the color a screen actually paints, which is whole values per channel, not on the exact arithmetic midpoint. At the middle of red to blue the exact blend is 127.5 in two channels; the painted color is #800080. Measuring the exact value would print 9.46:1 next to a swatch that is really 9.42:1, so the rounding happens first and the figure matches the square beside it.
Before you paste this into production
Related tools
URL Slug Generator
The address of the page this gradient sits at the top of, with the duplicates caught first - Open the tool
Random Name Generator
People to fill the cards and avatars sitting on that background while the copy is still being written - Open the tool
Color Generator
Picks the two ends when you have no palette yet, in hex, rgb and hsl at once - Open the tool
SEO Meta Tag Generator
Writes the theme-color and og tags that sit in the head of the same page - Open the tool
Table Generator
Turns a pasted range into Markdown or HTML for the content below the header - Open the tool
QR Code Generator
A symbol for the printed version, where the same contrast argument decides whether it scans - Open the tool
UUID Generator
Identifiers for the components and theme records this style ends up attached to - Open the tool
Generator verified by the LiczGrupa.pl team
Content, formulas and results have been reviewed for accuracy and relevance by our team of specialists.

Reviewed by: Natalia Skrzek