Skip to main content
Developer Tools

CSS Gradient Generator

Build linear, radial, and conic gradients visually. Copy as CSS, Tailwind class, full rule, or SVG. All client-side.

No upload — your files never leave your device

  • 100% private
  • Runs in your browser
  • Works offline
  • No sign-up
135°
0%
50%
100%
CSS
linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%)
CSS rule
.gradient {
  background-image: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%);
}
Tailwind className
bg-[linear-gradient(135deg,_#8b5cf6_0%,_#ec4899_50%,_#06b6d4_100%)]
SVG
<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400" viewBox="0 0 1 1" preserveAspectRatio="none"><defs><linearGradient id="g" x1="0.14644660940672627" y1="0.14644660940672627" x2="0.8535533905932737" y2="0.8535533905932737"><stop offset="0" stop-color="#8b5cf6"/><stop offset="0.5" stop-color="#ec4899"/><stop offset="1" stop-color="#06b6d4"/></linearGradient></defs><rect width="1" height="1" fill="url(#g)"/></svg>

About CSS Gradient Generator

CSS Gradient Generator builds linear, radial, and conic CSS gradients with a visual editor — drag the colour stops, change the angle on a dial, switch the gradient type with a tab, and copy production-ready CSS. The output is also available as a Tailwind arbitrary-value class or an inline SVG, which is handy for emails and OG images where CSS gradients don't render. A curated set of presets (sunset, aurora, mesh-style blends) gives you a starting point if you're not sure where to begin.

  • No uploads
  • Browser-only
  • Works offline
  • 100% free

How it works

  1. 1

    Pick a gradient type

    Choose linear, radial, or conic. The preview panel updates immediately so you can compare the visual difference between the three before committing.

  2. 2

    Drag stops, set the angle

    Click anywhere on the gradient bar to add a colour stop, drag stops to reposition, and use the colour picker on each one. Adjust the angle with the rotary control or type a value.

  3. 3

    Copy CSS, Tailwind, or SVG

    The output panel always shows the current gradient as three formats. Copy the one your stack uses — Tailwind for arbitrary-value classes, SVG when you need pixels in an image.

Linear, radial, conic — and when each one is right

CSS gives you three gradient functions, and they paint along different geometries. A linear-gradient runs colour along a straight axis you set by angle (0deg is bottom-to-top, 90deg is left-to-right, 135deg is the popular diagonal) — the workhorse for backgrounds, buttons and hero washes. A radial-gradient emanates from a centre point outward in ellipses, which is what you want for spotlights, glows, and soft vignettes. A conic-gradient sweeps colour around a centre like a clock hand, which makes it the one that can draw pie charts, colour wheels, and angular 'shine' effects — anything where the colour change is rotational rather than positional. Picking the wrong type is the most common reason a gradient 'won't look right' no matter how you nudge the stops: a sunburst wants conic, a glow wants radial, and forcing either out of a linear gradient is a losing battle. Full syntax reference: MDN's gradient docs.

Colour stops and hard stops: positions do the work

A gradient is just a list of colour stops, each pinned to a position along the axis (0% to 100%). Between two stops the browser interpolates a smooth blend; the positions decide where the transition happens and how wide it is. Spread two stops far apart and you get a gentle fade; bunch them close and the transition tightens. Pull them to the same position — say red at 50% and blue at 50% — and you get a hard stop: a crisp line with no blend at all, which is how you build stripes, two-tone splits, and flat colour bands without an image. This is the trick most people miss: gradients aren't only for soft fades. Equal-position stops turn linear-gradient into a precise stripe generator, and repeating-linear-gradient extends that into patterns.

Where it bites: forget to give your stops explicit positions and the browser distributes them evenly, which is rarely what you wanted for a three-or-more-colour gradient. Set the positions deliberately. Pull your stop colours from a real source — sample them off an image with the colour picker or generate a coherent set with the palette extractor — and the gradient stops looking like a default and starts looking designed.

The grey-band problem: how colours interpolate

Blend two vivid complementary colours — a saturated blue into a saturated yellow, say — and you'll often see an ugly muddy grey or brown smeared through the middle. That's not a bug in the tool; it's a consequence of interpolating in the sRGB colour space, where the straight-line path between two saturated colours dips through low-saturation territory and passes near grey. The eye reads that desaturated midpoint as dirt. Designers have fought this for years with workarounds: add an intermediate stop in a more saturated hue to route the blend around the grey zone, or choose colour pairs that are closer in hue so the path never sags toward neutral.

The modern fix is interpolating in a perceptual colour space — OKLCH or LCH — where the path between two colours keeps its chroma and the midpoint stays vivid. CSS now supports this with an 'in oklch' syntax on gradients. This tool outputs widely-supported sRGB syntax by default for maximum browser compatibility; if you hit the grey-band problem, the cleanest cure is to swap the interpolation space in the output to oklch, or insert a saturated mid-stop. Either beats accepting the mud.

Banding, and the formats CSS gradients can't reach

A perfectly smooth gradient can still show visible stairstep bands of colour, especially across a large area or a subtle low-contrast fade. The cause is bit depth: an 8-bits-per-channel display can represent only 256 levels per colour, and a gentle gradient stretched across many pixels may need finer steps than that, so adjacent bands of solid colour appear. It's most obvious in dark blues and greys on big backgrounds. Mitigations are limited in pure CSS — adding a faint noise/dither overlay is the classic trick, or steepening the gradient so each band is narrower and less noticeable. The other hard limit is reach: CSS gradients render in browsers, full stop. Email clients routinely strip them and Open Graph/preview images are static pixels, which is why this tool also emits an inline SVG gradient — self-contained, no external references — that survives in emails and rasterises into an OG image where a CSS gradient simply wouldn't exist.

Frequently asked questions about CSS Gradient Generator

  • Does the output use modern CSS like color-mix or oklch?

    No — output uses the widely supported background-image: linear-gradient/radial-gradient/conic-gradient syntax with sRGB hex colours. That works in every browser released in the last five years, including older WebViews. If you need OKLCH interpolation specifically, hand-edit the output to swap the colour space — the rest of the syntax stays the same.

  • Why does the Tailwind output use a bracket value instead of bg-gradient-to-r?

    Tailwind's built-in gradient utilities cap you at two or three stops and fixed directions. For anything richer — custom angles, multiple stops, radial or conic — an arbitrary-value class like bg-[linear-gradient(...)] is the clean way to drop in the full CSS without writing a new utility.

  • Can I use the SVG output as an Open Graph image?

    Yes — the SVG is self-contained with no external references, so you can save it as a .svg and reference it from an og:image meta tag, or convert it to PNG with any rasteriser. It also embeds cleanly into emails that strip CSS gradients.

Privacy, offline use, browser support, and pricing questions are answered on the site-wide FAQ.

See all Developer tools