Gradient to CSS Exporter
Stops
Angle
CSS
background: linear-gradient(90deg, #3B82F6 0%, #EF4444 100%); background-image: linear-gradient(90deg, #3B82F6 0%, #EF4444 100%); --gradient: linear-gradient(90deg, #3B82F6 0%, #EF4444 100%);
You Might Also Need
The gradient to CSS exporter writes a finished gradient three ways at once — the background shorthand, the explicit background-image property and a custom property — so it can be dropped into an existing stylesheet.
What is Gradient to CSS Exporter?
- The controls are the familiar stop and angle set; the panel at the bottom holds three declarations rather than one.
- All three describe the same gradient in the same notation, and differ only in how a stylesheet consumes them.
- The copy button takes all three together, so nothing has to be retyped.
The first line is the background shorthand, which is what most people reach for: one property, the gradient, done. The second repeats the identical value as background-image, which exists for a specific situation. The shorthand resets every background property it does not mention — position, size, repeat, attachment, origin, clip — so assigning a gradient with it can quietly undo a background position set elsewhere in the same rule. Using the longhand changes only the image and leaves the rest of the background stack intact. That distinction causes real bugs in stylesheets where a gradient is layered onto an existing background, and having both spellings side by side is the simplest way to avoid it.
The third line is a custom property holding the gradient value, which is the form worth understanding if you have not used it. Declaring a gradient once as a variable and referencing it from several rules means the palette can be changed in one place: a hover state, a themed variant and a fallback can all point at the same definition instead of repeating the stops. It also lets the gradient be assembled from other custom properties, so the stops themselves can vary by theme while the gradient expression stays fixed. The trade is that a custom property containing a gradient is only meaningful where it is consumed, so the declaration needs to sit somewhere both the definition and the use can see.
Which form you want depends on what you are doing with it. Copying into a fresh rule, the shorthand is fine. Editing a rule that already positions a background, the longhand is safer. Building a theme where several components share one treatment, the custom property is the right starting point. Because all three arrive together, the decision is made after copying rather than before, and there is no risk of the three drifting apart since they are generated from the same state.
The controls themselves cover what the rest of the cluster covers: any number of stops with individual colour and position sliders, and an angle from zero to three hundred and sixty degrees, with the angle always written in degrees rather than as a direction keyword. It is a linear gradient throughout — radial and conic are not produced here — and no vendor prefixes are added, since gradients have been unprefixed in every current browser for years.
Used as a gradient to css exporter, then, this is the page for getting a gradient into a stylesheet in whichever shape the stylesheet needs. Where the angle adjuster is about choosing the gradient, this one is about delivering it: three spellings, one copy, no retyping, and the copy gradient css code arrives ready for whichever of the three the rule can actually accept. Whether the rule wants the css gradient shorthand, the explicit background-image property, or a gradient custom property that several selectors can share, the export gradient css step is already done.
How to use Gradient to CSS Exporter
- Set the stops and the angle until the preview looks right.
- Copy the block — three declarations come together.
- Keep the shorthand for a fresh rule, the background-image line when a rule already sets background position or size.
- Use the custom property line when several rules should share one gradient definition.
When to use Gradient to CSS Exporter vs related tools
Use this when a gradient is being moved into a stylesheet and the form matters — layered backgrounds, theming, or several components sharing one treatment. Use the SVG or canvas generators when the destination is not CSS. When the gradient becomes one of many values a theme has to carry, the CSS custom properties exporter writes the whole variable block, and the design token generator takes the same values into a token file.
Privacy & Security
This tool runs entirely in your browser — no data ever leaves your device. There is no server round-trip, no upload, no logging, and no account required. Your input is processed locally using client-side JavaScript and is never stored, transmitted, or accessible to anyone else. When you close the tab, everything disappears.