Build linear, radial and conic gradients with live preview — pick colors, set angle, copy CSS
Used for Linear and Conic gradients
This tool generates the background CSS property for linear, radial, and conic gradients with a live preview. Pick your colors, add stops, set the angle, and the CSS updates in real time. Click Copy CSS to get the exact property ready to paste into your stylesheet — no vendor prefixes needed for modern browsers.
All generation happens in your browser. There's no server, no account, and no upload. The tool also saves your last gradient in localStorage so it's still there if you close the tab.
background property| Type | CSS Function | Direction | Best For |
|---|---|---|---|
| Linear | linear-gradient() | Straight line at any angle | Backgrounds, hero sections, buttons |
| Radial | radial-gradient() | Outward from center point | Spotlight effects, vignettes, buttons |
| Conic | conic-gradient() | Rotation around a center point | Pie charts, color wheels, spinners |
| Repeating Linear | repeating-linear-gradient() | Tiling straight line | Stripes, patterns, textures |
Copy any of these directly into your CSS:
| Angle | Keyword Equivalent | Direction |
|---|---|---|
| 0deg | to top | Bottom → Top |
| 90deg | to right | Left → Right |
| 135deg | to bottom right | Top-left → Bottom-right |
| 180deg | to bottom | Top → Bottom |
| 270deg | to left | Right → Left |
rgba(0,0,0,0) at one end often produces a grey muddy middle. Use the actual hue at low opacity instead (e.g. rgba(79,70,229,0))to bottom not 180deg — keyword directions are more readable and mean the same thing, making your CSS easier to maintainbackground: linear-gradient(...), linear-gradient(...) — the first listed is on topLinear gradients flow along a straight line at a set angle — the most common type for backgrounds and buttons. Radial gradients expand outward from a center point, useful for spotlight and vignette effects. Conic gradients rotate around a center point like a color wheel, mainly used for pie charts and spinner animations.
Yes, there's no limit on color stops. Each stop is a color value followed by an optional position: linear-gradient(90deg, red 0%, blue 50%, green 100%). Omitting positions lets CSS distribute stops evenly.
Linear and radial gradients work in every modern browser with no prefixes needed. Conic gradients require Chrome 69+, Firefox 83+, Safari 12.1+, Edge 79+ — all current versions. No browser in active use today lacks support.
Use rgba() with alpha 0 for the transparent end: linear-gradient(to bottom, rgba(0,0,0,0.8), rgba(0,0,0,0)). Avoid using the keyword transparent — browsers interpolate it through grey, which looks muddy. Use the actual color at zero opacity instead.
Standard transition doesn't work on gradients. The workaround is animating background-position on an oversized gradient, or using the newer @property to register typed custom properties that can be transitioned. The @property approach works in Chrome and Edge; Firefox support arrived in version 128.
Gradients are technically images, so they go on background-image. Using the shorthand background works too and is more common. If you set background-image separately, make sure you don't also set background elsewhere or it will override the gradient.
Once you've got the basics down, these techniques are what separate amateur CSS from genuinely polished UI work. They're not complicated — just patterns most tutorials skip over.
A normal gradient blends smoothly between colors. A hard stop makes two colors meet with zero blending — like a sharp line. You do this by giving the same position to two different color stops:
Stripes like this are used constantly for loading states, "under construction" banners, and progress bar textures. The trick is that the repeating version tiles itself automatically — you just define one stripe unit and the browser repeats it across the whole element.
CSS lets you stack multiple backgrounds on a single element, separated by commas. The first one listed sits on top, the last one at the bottom. This is how you get complex layered effects without any images:
That last example is what gives a lot of modern SaaS hero sections their "glowy" look — it's just three gradients stacked. No SVG blobs, no images, just CSS.
Here's something that trips up a lot of developers: transition and animation don't work directly on gradient values. If you try to transition a background gradient, nothing happens. The workaround most people use is the "sliding background" trick:
You make the gradient 400% wide, then animate its position. From the user's perspective it looks like the colors are slowly shifting — which is exactly the effect you want for hero sections and loading screens. This works in every browser, no special support needed.
This is a question that comes up a lot, so here's the real picture. The short version: if you're targeting browsers from the last 3–4 years, you're fine with everything including conic gradients. The only thing to watch out for is the @property trick for animated gradients, which still isn't in Firefox older than version 128.
| Feature | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| linear-gradient() | 26+ | 16+ | 6.1+ | 12+ |
| radial-gradient() | 26+ | 16+ | 6.1+ | 12+ |
| conic-gradient() | 69+ | 83+ | 12.1+ | 79+ |
| repeating-linear-gradient() | 26+ | 16+ | 6.1+ | 12+ |
| @property (animated gradients) | 85+ | 128+ | 16.4+ | 85+ |
The vendor prefixes (-webkit-linear-gradient etc.) that you might see in older code are no longer needed. Any browser that needs them is so old it represents less than 0.1% of traffic. Just write unprefixed CSS.
This one genuinely matters and gets ignored all the time. If you put text over a gradient background, the contrast ratio changes across the element. The left side might pass WCAG AA (4.5:1) and the right side might fail — and most contrast checkers only let you check a single colour at a time.
A few practical rules that will save you from accessibility issues:
linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)) as the topmost layer. It darkens everything uniformly without touching your design gradient.#ffffff and ends at #e0e7ff (both very light) will fail contrast against white text across its entire length.This is a practical performance question. CSS gradients are rendered by the browser's paint engine — they have zero bytes of download cost and scale perfectly to any resolution. A PNG or JPEG background image has a file size, needs an HTTP request, and can look blurry on high-DPI (Retina) screens if you didn't export it at 2x.
The cases where you'd still choose an image over a gradient:
For everything else — hero backgrounds, card fills, button styles, divider effects, overlays — a CSS gradient is faster, smaller, and more flexible than any image you could use. It also responds to dark mode and user preferences without you having to manage separate image assets.
These are production-ready snippets modelled on gradients used across popular design systems and products. Copy them directly and adjust the colors to match your palette.