CSS Gradient Generator
Design linear and radial CSS gradients visually and copy the generated code instantly, free online. Build a hero section background, a multi-color blend, or a spotlight effect, with live preview and no sign-up required.
linear-gradient(90deg, #ff0080 0%, #7928ca 100%)Usage examples
Building a hero section background
Pick two brand colors, adjust the angle until it matches your design, then copy the generated 'background' value straight into your CSS file.
Creating a spotlight or vignette effect
Switch to radial mode, set the shape to circle and the position to center, then fade from a bright color to transparent or dark for a spotlight look.
Making a smooth multi-color gradient
Add a third or fourth color stop and drag their positions to control exactly where each color transition happens.
Building a subtle background for a card or button
Pick two closely related shades of the same hue and a shallow angle like 10deg for a gradient that reads as a near-solid color but adds depth.
Matching a gradient from a design file
Set the shape to ellipse and the position to top left to approximate an off-center radial glow often used in design mockups, then fine-tune the color stops to match.
Quick reference
Linear: Angle
| Angle | CSS |
|---|---|
| 0° | linear-gradient(0deg, #ff0080 0%, #7928ca 100%) |
| 45° | linear-gradient(45deg, #ff0080 0%, #7928ca 100%) |
| 90° | linear-gradient(90deg, #ff0080 0%, #7928ca 100%) |
| 135° | linear-gradient(135deg, #ff0080 0%, #7928ca 100%) |
| 180° | linear-gradient(180deg, #ff0080 0%, #7928ca 100%) |
| 225° | linear-gradient(225deg, #ff0080 0%, #7928ca 100%) |
| 270° | linear-gradient(270deg, #ff0080 0%, #7928ca 100%) |
| 315° | linear-gradient(315deg, #ff0080 0%, #7928ca 100%) |
Radial: Shape / Position
| Shape | Position | CSS |
|---|---|---|
| Circle | Center | radial-gradient(circle at center, #ff0080 0%, #7928ca 100%) |
| Ellipse | Center | radial-gradient(ellipse at center, #ff0080 0%, #7928ca 100%) |
| Circle | Top | radial-gradient(circle at top, #ff0080 0%, #7928ca 100%) |
| Circle | Bottom | radial-gradient(circle at bottom, #ff0080 0%, #7928ca 100%) |
| Circle | Left | radial-gradient(circle at left, #ff0080 0%, #7928ca 100%) |
| Circle | Right | radial-gradient(circle at right, #ff0080 0%, #7928ca 100%) |
| Circle | Top left | radial-gradient(circle at top left, #ff0080 0%, #7928ca 100%) |
| Circle | Top right | radial-gradient(circle at top right, #ff0080 0%, #7928ca 100%) |
| Circle | Bottom left | radial-gradient(circle at bottom left, #ff0080 0%, #7928ca 100%) |
| Circle | Bottom right | radial-gradient(circle at bottom right, #ff0080 0%, #7928ca 100%) |
Color stops
| Pattern | CSS |
|---|---|
| Two colors | linear-gradient(90deg, #ff0080 0%, #7928ca 100%) |
| Three colors | linear-gradient(90deg, #ff0080 0%, #fbbf24 50%, #7928ca 100%) |
| Shorter blend zone | linear-gradient(90deg, #ff0080 25%, #7928ca 75%) |
| Hard stop (two-tone split) | linear-gradient(90deg, #ff0080 50%, #7928ca 50%) |
| Hard stops (three bands) | linear-gradient(90deg, #ff0080 0%, #ff0080 33%, #fbbf24 33%, #fbbf24 66%, #7928ca 66%, #7928ca 100%) |
Frequently asked questions
Is the generated CSS compatible with all browsers?
Yes. Both 'linear-gradient()' and 'radial-gradient()' are standard CSS and have been supported by all major modern browsers for years. No vendor prefixes are needed.
Can I use more than two colors?
Yes. Click 'Add stop' to add as many color stops as you like, and set each one's position percentage to control exactly where it sits in the gradient.
What's the difference between linear and radial gradients?
A linear gradient transitions colors in a straight line at a given angle. A radial gradient spreads colors outward from a center point in a circle or ellipse shape.
Does this tool send my design anywhere?
No — everything is computed and rendered locally in your browser. Your gradient settings are saved to your browser's local storage so you can pick up where you left off.
Does this tool support conic gradients?
Not currently — only 'linear-gradient()' and 'radial-gradient()' are supported. Conic gradients (which sweep colors around a center point like a color wheel) use a separate 'conic-gradient()' function with different syntax.
What do the position percentages on each color stop mean?
Each stop's percentage marks where along the gradient line (for linear) or from the center outward (for radial) that color reaches its full, unmixed value. Between two stops, CSS smoothly interpolates the color. Setting two stops to the same percentage creates a hard edge instead of a smooth blend.
Why does my radial gradient look stretched instead of circular?
If the shape is set to 'circle' but still looks stretched, check the element's width and height — a circle shape is always perfectly round regardless of the container's aspect ratio, but the container itself may be non-square, making the gradient appear to only fill part of it. Use 'ellipse' if you want the gradient to naturally match the container's proportions.