CSS Gradient Generator

Build a linear or radial gradient from your own color stops. Watch the preview update as you drag, then copy the background rule or a ready HTML snippet.

Live preview
Preview

Color stops

Presets

style.css
index.html

A hero banner, a button, a loading bar: two flat colors and a direction cover most of what a gradient needs to do. This tool sticks to exactly that job, linear and radial, so the controls stay on one screen instead of spread across tabs.

Linear or radial, picked up front

Switch the type dropdown and the panel below it changes with it. Linear shows direction and angle controls. Radial swaps those for a position picker, since a radial gradient radiates from a point instead of running along a line. Both share the same color stop list, so a palette built for one carries straight over if you switch types.

Setting the angle the way CSS reads it

The direction dropdown covers the eight compass keywords to bottom, to top right, and so on, plus a Custom angle option that hands control to the slider. The number the slider shows goes straight into the CSS as degrees, following the same convention the spec uses: 0deg points to the top of the box and the angle increases clockwise, so 90deg runs left to right and 180deg runs top to bottom.

A keyword like to bottom right is not the same as 135deg, even though both look diagonal. The keyword form aims at the box's actual corner, so the angle it renders at bends with the element's aspect ratio. A wide banner and a square thumbnail using to bottom right point in visibly different directions. A numeric angle like 135deg holds that exact compass bearing regardless of the box's shape. Reach for the keyword when the gradient should always terminate at a corner, and for a fixed angle when it should look the same on every element.

Stops sort themselves, so list order doesn't matter

Each color stop carries its own position from 0 to 100 percent. Before the CSS gets built, the tool sorts the stops by that position, not by the order you added them in. Add a third stop and type in a position between two existing ones and the gradient inserts it there, even though it sits at the bottom of the list on screen. At least two stops stay required, the remove button on a stop disables itself once only two are left.

What each preset does

Sunset, ocean, forest, purple, and grayscale each drop in a two-color pair. Rainbow is the exception, it loads seven stops spaced evenly across the full color wheel. Clicking any preset replaces every stop currently in the list rather than adding to it, so a custom palette in progress gets cleared the moment a preset is clicked.

Where this tool stops

The radial mode here always builds radial-gradient(circle at <position>). There is no ellipse shape and no size keyword like closest-side or farthest-corner, options CSS does support for radial gradients. Conic and repeating gradients are not covered either. If a project needs any of those, or wants PNG or SVG export alongside the CSS, the Color category's Gradient Generator covers that wider range with the tradeoff of a busier interface.

Questions about the gradient generator

Details that come up once a gradient goes from this preview into real CSS.

Does this tool build conic or repeating gradients?

No. This generator covers linear and radial gradients only, and the radial mode is always a plain circle. For conic gradients, repeating patterns, ellipse shapes, or PNG and SVG export, use the Color category's Gradient Generator instead.

What does 0deg mean on the angle slider?

It follows the CSS gradient angle convention: 0deg points straight up, and the angle increases clockwise from there. 90deg runs left to right, 180deg runs top to bottom, and 270deg runs right to left.

Why is a compass direction like "to bottom right" different from typing 135deg?

The keyword direction aims at the element's actual corner, so its angle shifts with the box's width and height. A numeric angle stays fixed at that exact bearing no matter what shape the element is.

Can I drag color stops into a new order?

The list order does not control the gradient. Each stop has a position from 0 to 100 percent, and the tool sorts stops by that number when it builds the CSS, regardless of where the row sits in the list.

Does clicking a preset add colors to what I already have?

No, a preset replaces every color stop currently set. Build a custom palette first if you want to keep it, since applying a preset afterward clears it.

Does this tool upload or store the gradient I build?

No. The preview, the CSS, and the HTML snippet are all generated in your browser with JavaScript. Nothing you enter is sent to a server.