CSS Gradient Generator
Design linear and radial gradients visually and copy the exact CSS. Multiple stops, adjustable angle, live preview — free.
Design linear and radial gradients visually and copy the exact CSS — the preview applies the same string the tool emits, so what you see is byte-for-byte what you paste into your stylesheet. Up to six color stops with numeric positions and an angle dial.
How to use CSS Gradient Generator
- Set the stops: color, position, count.
- Pick linear or radial and set the angle.
- Copy the CSS line straight into your stylesheet.
Who it is for
Developers building hero backgrounds and buttons, designers prototyping modern UI treatments, and anyone who has tweaked a gradient by hand for twenty minutes and still not matched the design.
How it works
- Linear mode emits the standard angle syntax; radial emits circle-at-center with the same stop list.
- Stops are added, colored, positioned numerically, and removed independently — up to six stops.
- The preview element uses the generated string directly, so rendering differences are impossible.
What it cannot do
- It builds color gradients — mesh gradients, conic sweeps, and animated transitions are outside its scope.
- Very close stop positions (like 0% and 2%) render as a hard edge; that is CSS behavior, not a bug.
Sample input & output
Linear gradient, Angle: 135deg, Stops: #0F172A at 0%, #1D4ED8 at 55%, #38BDF8 at 100%
background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #38bdf8 100%); — live swatch rendered directly from the CSS string.
Frequently asked questions
Why does the preview match my site differently?
The preview is the same CSS string; differences come from your page’s own stacking, sizing, or color profile — not from the gradient itself.
What angle does 135deg mean?
CSS angles run clockwise from "to top": 135deg points toward the bottom-right corner, the most common modern default.
Can I add more than two stops?
Yes — up to six, each with its own color and numeric position, exactly like the CSS spec’s stop list.
How does CSS gradient angle geometry work (0deg versus 90deg versus 180deg)?
CSS Images Module Level 3 uses bearing-compass angles rather than standard counter-clockwise Cartesian trigonometry: 0deg points straight up (equivalent to "to top"), and angles rotate clockwise so 90deg flows left-to-right ("to right"), 135deg flows from top-left toward bottom-right, and 180deg (the browser default when omitted) flows top-to-bottom.
Why do CSS gradients between complementary colors sometimes look gray or muddy in the middle?
Standard CSS gradients interpolate color stops linearly inside gamma-encoded sRGB space. Walking a straight line across the sRGB cube between opposite hues like blue (#2563EB) and orange (#F97316) passes straight through the desaturated gray core of the cube. Adding an intermediate saturated mid-stop (such as purple or magenta at 50%) steers the path around the gray center.
What causes visible color banding in subtle dark gradients, and how can I minimize it?
In 8-bit-per-channel sRGB displays, each RGB channel has only 256 discrete integer steps (0–255). Stretching a dark slate transition from #0F172A to #1E293B across a 1,400-pixel hero banner spans barely fifteen integer steps, creating visible Mach bands. Increasing luminance span slightly or introducing a gentle hue shift across three stops distributes dithering steps across multiple RGB channels.
How do I create crisp striped dividers or split backgrounds using CSS color stops?
When two adjacent stops share the exact same percentage position — for instance, linear-gradient(90deg, #2563eb 50%, #f8fafc 50%) — CSS creates an instantaneous zero-width transition between the two colors with anti-aliased diagonal edges at non-orthogonal angles. In this generator, placing two stops 0% or 1% apart gives you a clean split background without extra DOM elements.