CSS Gradient Generator
Create beautiful CSS gradients visually
100% client-side processing
This CSS gradient generator gives you a visual playground for building linear, radial, and conic gradients, then hands you production-ready CSS in one click. Instead of guessing hex values in a stylesheet and refreshing the browser, you tweak colors, angles, and positions live until the result looks right, and copy a value you can paste straight into a rule.
Gradient Types at a Glance
| Type | Axis | Angle used? | Typical use |
|---|---|---|---|
| Linear | A straight line across the element | Yes | Hero backgrounds, buttons, borders |
| Radial | Rays from a center point | No — uses circle or ellipse | Spotlights, vignettes, glow effects |
| Conic | A sweep around a center | Yes (starting seam) | Color wheels, pie and progress charts |
All three are CSS functions — linear-gradient(), radial-gradient(), and conic-gradient() — not image files. The browser computes the pixels, so the result scales to any element size without blurring and costs nothing in network terms.
How to Build One Here
- Pick the type. Linear, radial, or conic. Changing the type immediately changes which controls matter.
- Set the geometry. For linear and conic, adjust the angle. For radial, choose circle or ellipse.
- Edit the color stops. Each row has a color swatch and a position from 0 to 100. Add rows with the Add color stop button.
- Copy the CSS. The generated declaration is shown beneath the preview; the Copy button puts it on your clipboard.
The preview panel reflects every change instantly, so the code you copy is exactly the gradient you see. New stops default to a pink at 50%, and each stop’s position is a free number rather than a fixed slot, so you can place two stops at 20% and 25% for a tight band or bunch several at 100% to create a sharp final edge. The generator sorts stops by position before emitting the CSS, which means the visual order always matches the numeric order even if you typed them out of sequence.
Worked Example: A Three-Stop Button Gradient
Start from two stops and add one in the middle:
#3b82f6at 0%#8b5cf6at 50%#ec4899at 100%- Type: linear, angle: 135deg
The generated value is:
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
A 135deg linear gradient runs from the top-left corner toward the bottom-right. Because the midpoint is a distinct violet rather than a blend of blue and pink, the transition stays clean. The same three stops with a radial type become radial-gradient(circle, …) and ignore the 135deg entirely.
Angles, Shapes, and Axes
For linear gradients, 0deg points up and angles increase clockwise, so 90deg sweeps left to right and 180deg top to bottom. For conic gradients, the same angle conventions rotate the starting seam. For radial gradients, the shape controls whether the rays form a perfect circle or stretch with the element as an ellipse. The stop positions are percentages along that axis: on a linear gradient, 0% is the end the axis starts from, and 100% is the far end. Two stops at the same position create a hard color boundary, which is how you build stripes and pie slices.
Angle values wrap: entering 450 is equivalent to 90, because the generator normalises the number into a 0–360 range. Negative angles also work and wrap the other way. The preview is sized to its container rather than a fixed width, so a gradient that looks right in the panel will stretch correctly when applied to a full-width hero. Because the panel and your target element receive the identical declaration, any difference after pasting comes from layout context — element size, border radius, overlaying content — rather than from the gradient itself.
Avoiding Muddy Midpoints
The most common visual complaint with gradients — a gray haze in the center of a blue-to-orange or red-to-green transition — comes from sRGB interpolation. The browser blends each channel independently, and complementary hues cross in the middle of the color cube. Two fixes work well: insert an intentional intermediate stop (a teal between blue and yellow), or stay within neighbouring hues and let lightness carry the variation. Dithering is not something this tool adds, so banding on large, low-contrast gradients can still appear on some displays; adding a subtle third stop usually breaks up the bands.
Gradients also complicate text contrast. A gradient can pass a contrast check at both endpoints and still dip below the threshold in the middle, so if you are placing a headline over it, sample the midpoint by eye or check the lightest and darkest regions separately rather than testing only the extremes. Darkening one end or adding a translucent overlay behind the text is usually simpler than redesigning the whole gradient.
Limitations
The generator emits a single background declaration using standard syntax supported by current browsers. It does not write vendor prefixes, so very old browsers will not understand the result. It also does not implement repeating-linear-gradient, color interpolation hints, or the newer in oklab interpolation method — the output is plain sRGB. The preview uses the same CSS you copy, so what you see in the panel is what a modern browser will paint.
Color input is limited to the swatch picker, which works in hex, and the emitted value is whatever the picker reports. If your design system expects a different color format, such as hsl() or an RGB triplet, you will need to convert after copying. There is no saved history and no export of a .css file; the workflow is deliberately one gradient at a time.
Related Tools
Frequently Asked Questions
Why does changing the angle do nothing for a radial gradient?
Radial gradients radiate outward from a center, so direction is expressed by the shape (circle or ellipse), not an angle. The angle value is only used by linear gradients and by the rotation offset of conic gradients. Switching the type back to linear or conic makes the angle effective again.
How many color stops can I add?
The builder starts with two and its Add color stop button creates as many more as you like. Each stop is a color plus a percentage position between 0 and 100. Very large counts are legal CSS but get hard to manage by hand, so most production gradients use two to five stops.
What does 'from 90deg' mean in a conic gradient?
It rotates where the conic sweep begins. In CSS a conic gradient's 0deg seam points to the top of the element and progresses clockwise, so 'from 90deg' moves the starting line to the right edge. The angle rotates the whole color wheel rather than changing its direction of travel.
Why does a two-color gradient look muddy or gray in the middle?
Browsers interpolate between color stops in sRGB, which can pass through desaturated territory when the two colors are far apart on the wheel — blue to orange is the classic example. Adding an intermediate stop, or choosing neighbouring hues, keeps the midpoint vivid.
Can I build a pie chart with the conic gradient?
Yes, by giving adjacent stops the same position, which produces a hard edge instead of a blend. The generator sorts stops by position before writing the CSS, so setting two stops to 25% yields a crisp boundary at a quarter turn. Rounded corners and labels still need separate DOM elements.
What exactly does the Copy button put on my clipboard?
The full CSS declaration, including the property, for example `background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);`. Paste it directly into a rule in your stylesheet — no additional wrapper is needed.
Reviewed by the HandyTools Hub team · Last updated