Click bar to add stop · Drag handles · Click handle to select
background: linear-gradient(135deg, #7c6dfa 0%, #c47fff 50%, #4dd9c0 100%);
CSS Gradient Generator — Linear, Radial, Conic & Animated
What's included
Features
About this tool
Build a CSS Gradient Visually — Then Copy the Code for Background, Text, or Border
You need a CSS gradient for a hero background, a gradient text heading, or a gradient card border — but writing linear-gradient(135deg, #667eea 0%, #764ba2 100%) from memory is tedious, and every small tweak means running back to the browser. Build it here visually, see it live in the exact context you need, and copy the complete CSS with one click.
The interactive gradient bar shows each color stop as a draggable handle. Drag to reposition stops. Click anywhere on the bar to add a new stop — the color is auto-interpolated from the gradient at that exact position so new stops blend naturally. Select any stop to change its color or opacity. Three gradient types: linear (any angle), radial (circular outward from a center), and conic (rotational sweep, useful for color wheels and pie charts).
Three preview modes let you see the gradient in the context you actually need. Background fills the preview area — for hero sections and full-bleed backgrounds. Text clips the gradient to display typography using background-clip: text — for gradient headings and logos. Border shows the gradient as a card outline and filled button simultaneously. The CSS export updates automatically for whichever mode is active, including the correct -webkit-background-clip prefix for Safari.
For animated gradients, six presets generate complete @keyframes CSS with no JavaScript required: Slide (flowing background-position), Diagonal (corner-to-corner), Hue Shift (hue-rotate cycle), Breathe (background-size pulse), Pulse (opacity fade), and Spin (angle rotation via @property). Adjust speed from 1s to 12s and copy the full animation block for your stylesheet.
Click-to-add works by linearly interpolating between the two nearest stop colors at the click position — the bar sorts stops by percentage, finds which pair straddles the clicked point, and blends their RGB channels by the fractional distance between them, so a new stop always starts as a believable blend rather than a jarring random color. The bar tells a click on empty space apart from a press on an existing handle by comparing the event target directly against the bar element itself, which is what lets dragging a handle and clicking to add a stop share the same element without misfiring. The Spin preset is the one animation that can't be done with plain background-position tricks, because you can't animate a gradient's angle argument directly — CSS has no keyframe-able "gradient angle" property by default. It works around that by registering a custom property with @property and an explicit <angle> syntax, which tells the browser the property is animatable, then keyframes that custom property from 0deg to 360deg and feeds it into the gradient with var(); this is why the exported Spin CSS is the only preset marked Chrome/Edge only, since @property isn't supported everywhere. The Tailwind export only maps to a named direction class (bg-gradient-to-br and friends) for the eight compass angles Tailwind ships utilities for; any other angle, or any gradient with more than two stops, falls back to Tailwind's arbitrary-value bracket syntax with the full CSS gradient string inlined. Every setting — mode, stops, angle, animation, preview mode — auto-saves to localStorage 600ms after your last change and silently restores on your next visit.
Step by step
How to Use
- 1Choose a gradient typeSelect Linear, Radial, or Conic from the Type section in the left panel. Linear uses a straight-line direction at any angle. Radial radiates outward from a focal center point. Conic sweeps colors rotationally — great for pie charts and color wheels. The preview updates immediately.
- 2Edit color stops on the gradient barThe interactive gradient bar shows each stop as a draggable handle. Drag a handle left or right to reposition the stop. Click anywhere on the bar to add a new stop — its color is auto-interpolated from the gradient at that position so new stops blend naturally. Click a handle to select it, then use the color picker and position slider to adjust that stop.
- 3Set type-specific parametersFor linear gradients, drag the Angle slider or type a degree value — 0° is top-to-bottom, 90° is left-to-right, 135° is diagonal. For radial gradients, use the X and Y center sliders to position the focal point. For conic gradients, use the From Angle slider to set the starting sweep angle.
- 4Apply an animation presetIn the Animate section, choose one of the six presets: Slide (flowing background-position), Diagonal (corner-to-corner shift), Hue Shift (hue-rotate cycle), Breathe (background-size pulse), Pulse (opacity fade), or Spin (angle rotation). Adjust the Speed slider from 1s to 12s. The preview animates live and the CSS export includes the full @keyframes block.
- 5Switch the preview modeToggle between Background (full fill), Text (gradient clipped to typography using background-clip: text), and Border (card outline and button). Each mode updates the export code automatically — for Text mode the CSS includes -webkit-background-clip prefix for Safari.
- 6Load a preset or randomizeClick any of the 8 preset swatches in the Presets section (Cosmic, Sunset, Ocean, Forest, Fire, Neon, Aurora, Rose) to instantly load a professionally chosen gradient. Click Randomize in the preview toolbar to shuffle all stop colors for quick exploration.
- 7Export the codeSwitch between CSS, Tailwind, and SCSS tabs at the bottom of the panel. CSS gives the background property plus @keyframes if animation is active. Tailwind gives utility class strings. SCSS gives a $gradient variable with a .element class. Click Copy to copy the output.
Real-world uses
Common Use Cases
Got questions?
Frequently Asked Questions
Select the gradient type (Linear, Radial, or Conic), drag color stop handles on the gradient bar, and click anywhere on the bar to add more stops. The live preview updates instantly. When the gradient looks right, click the CSS tab in the export panel and copy the generated background property — ready to paste into your stylesheet.
Switch to Text preview mode using the mode toggle above the preview. The gradient is clipped to display text using background-clip: text and color: transparent. The CSS export includes the required -webkit-background-clip: text prefix for Safari compatibility. Copy and paste onto any heading or display element. Works in all modern browsers.
Select an animation preset from the animation panel — Slide, Diagonal, Hue Shift, Breathe, Pulse, or Spin. Adjust the speed slider from 1s (fast) to 12s (slow ambient). The CSS tab exports the full @keyframes block and the animation property — paste everything into your stylesheet and the animation runs with no JavaScript required.
Linear gradients transition along a straight line at a specified angle — 90deg is left-to-right, 135deg is diagonal, 180deg is top-to-bottom. Radial gradients transition outward from a focal center point in a circular or elliptical pattern. Conic gradients sweep colors rotationally around a center point — useful for pie charts, color wheels, and progress rings.
Click anywhere on the interactive gradient bar to add a new stop — the color is automatically interpolated from the gradient at that position so the new stop blends naturally. Drag any handle to reposition it. Click a handle to select it, then use the color picker and opacity slider to change its appearance. Remove a stop by selecting it and clicking the delete button.
Switch to the Tailwind tab in the export panel. For simple directional gradients, it generates bg-gradient-to-r (or other direction variants) with from-, via-, and to- color classes. For complex gradients with custom angles or more than three stops, it uses Tailwind arbitrary value syntax: bg-[linear-gradient(135deg,#667eea_0%,#764ba2_100%)]. Copy and paste directly into a className attribute.
A conic gradient sweeps colors rotationally around a center point — like a clock face or a pie chart. Use conic-gradient() for pie charts (each color stop covers an arc percentage), color wheel backgrounds, loading spinners with a gradient arc, and donut chart segments. All modern browsers support it.
Yes — completely free, no sign-up required. All gradient generation and code export runs in your browser. No gradient data or color values are sent to any server. Works offline once the page has loaded.