Skip to content
1001 Tools
sr
Developer tools

CSS Gradient Generator

Pick colours, drag the stops, set an angle, and copy a CSS gradient you can paste straight into a stylesheet. The preview updates as you change anything, so you see the exact result before touching your code. Nothing is uploaded — everything runs in your browser.

Colour stops
Preview
CSS

How it works

A linear gradient blends colours along a straight line. The angle sets the direction of that line: 0deg points the transition upward, 90deg runs left to right, 180deg downward, and 270deg right to left. Each colour stop has a position from 0% to 100% that says where along the line that colour lands; the browser smoothly interpolates the colours between neighbouring stops. A radial gradient instead blends outward from a centre point in rings, which is why the angle does not apply to it — this tool uses a plain circular radial shape.

The output is a single `background` declaration using the standard `linear-gradient()` or `radial-gradient()` function. Both have been supported unprefixed in every current browser for years, so you no longer need `-webkit-` or `-moz-` versions for modern targets. Because a gradient is generated by the browser rather than downloaded, it costs no extra network request and scales to any element size without blurring.

Practical examples

A two-colour hero background

A linear gradient from indigo #6366f1 at 0% to pink #ec4899 at 100% at 90deg gives a left-to-right band that works well behind a landing-page headline. Change the angle to 135deg for a diagonal that draws the eye toward the bottom-right.

A subtle button gradient

For a raised button, keep the two colours close: #3b82f6 at 0% to #2563eb at 100% at 180deg. The slight top-to-bottom shift reads as depth without looking like a rainbow. Add matching hover colours by nudging both a shade darker.

A soft radial glow

Switch to radial and go from #fef3c7 at 0% to #f59e0b at 100% for a warm circular glow, useful as a card background or behind an icon. The lighter colour sits in the centre and darkens toward the edges.

Frequently asked questions

What do the angle degrees mean?

The angle sets the direction a linear gradient travels. 0deg goes bottom to top, 90deg goes left to right, 180deg top to bottom, and 270deg right to left. Values in between give diagonals — 45deg runs toward the top-right corner.

Why is the angle disabled for radial gradients?

A radial gradient spreads outward from a centre point in concentric rings rather than along a straight line, so there is no single direction to angle. This tool generates a circular radial gradient, where the first colour sits at the centre and the last reaches the edge.

Can I use more than two colours?

Yes. Use the Add colour button to insert extra stops, up to five. Each stop has its own position, so you can place a third colour at 50% to create a distinct middle band or an uneven blend.

What does the position percentage control?

It sets where along the gradient a colour is fully itself. Two stops at 0% and 100% spread the blend across the whole element. Moving a stop to 20% compresses that colour into the first fifth and stretches the transition to the next colour across the rest.

Can I make part of the gradient transparent?

The colour picker here works in solid hex, but you can edit the copied CSS by hand to use rgba() or an 8-digit hex with an alpha channel, for example rgba(0,0,0,0) as one stop. Fading a colour to transparent is a common way to overlay a gradient on a photo.

Do I still need browser prefixes like -webkit-?

Not for current browsers. Unprefixed linear-gradient() and radial-gradient() have been supported for years across Chrome, Firefox, Safari and Edge. You would only add -webkit- prefixes if you must support very old mobile Safari or similar legacy engines.

My gradient is not showing up — what is wrong?

The most common causes are applying it to an element with no height or width, or having another background rule override it. Make sure the element has size, that this background declaration is not being overwritten later in the cascade, and that the property is background or background-image.

How is a CSS gradient different from a gradient image?

A CSS gradient is drawn by the browser from a text rule, so it is tiny, always sharp at any size, and easy to tweak. An exported PNG or JPG is a fixed-resolution file that adds a download and can look blocky when scaled. For flat colour blends, CSS is almost always the better choice.

Should I use background or background-image?

This tool outputs the shorthand background property, which is fine on its own. If an element already has a background colour you want to keep as a fallback, use background-image for the gradient instead so the colour stays underneath.

Are CSS gradients bad for performance?

No. They are cheap to render and add no network requests. Very large gradients that animate on every frame can cost a little on low-end devices, but a static background gradient has no meaningful performance impact.

Can I animate a gradient?

Browsers cannot smoothly transition between gradient definitions the way they do with a solid colour. To animate one, people usually make an oversized gradient and shift its background-position, or fade between two stacked layers. The static CSS from this tool is your starting point.

Why do my colours look banded?

Visible steps between colours usually come from too small a colour difference over too many pixels, or a low-bit display. Placing stops closer together or choosing colours with more contrast reduces the effect; there is no way to fully avoid it on some screens.

Is anything uploaded when I use this?

No. The gradient is built entirely in your browser from the controls on the page. No colours, code or images leave your device.

Related tools