A CSS gradient generator lets you build a linear, radial or conic gradient visually — pick your colors, set their positions and an angle, watch the live preview update, then copy the exact CSS. This tool builds real linear-gradient(), radial-gradient() and conic-gradient() values with up to four color stops, so you can go from an idea to production-ready CSS in seconds instead of hand-tuning percentages and hex codes in a stylesheet.
What This CSS Gradient Generator Does
Choose a gradient type — linear, radial, or conic — set an angle where relevant, and define two to four color stops with a color and a position percentage each. The live preview box updates instantly with every change, and the CSS textarea below it always shows the exact, ready-to-paste value. Enable Stop 3 or Stop 4 with their checkboxes to build a richer multi-color gradient, or leave them off for a clean two-color blend.
The generated CSS is a single background declaration you can drop straight into any element's stylesheet rule — no extra setup, no vendor prefixes needed in any current browser, and nothing depends on external libraries or images.
How to Use the CSS Gradient Generator
- Pick a gradient type. Linear moves in a straight line across an angle, radial expands outward from a center point, and conic sweeps around a center point like a color wheel.
- Set the angle. For linear gradients this is the direction the color flow travels; for conic it's the starting angle of the sweep. Radial gradients ignore this field.
- Set your first two color stops. Pick a color and a position (0–100%) for each. These two are always active.
- Add more stops if you want. Tick "Use" next to Stop 3 or Stop 4 to blend in a third or fourth color at its own position.
- Copy the CSS. Click "Copy CSS" to grab the exact
backgroundvalue and paste it into your stylesheet.
Why Gradients Go in background, Not color
This trips up a lot of people learning CSS for the first time: a gradient is not a color value — it's a generated image. As the MDN gradient documentation explains, functions like linear-gradient(), radial-gradient() and conic-gradient() all belong to the CSS <image> data type — the same category as url() for a background photo.
That's why you'll never see a gradient work as a value for the color property (which only accepts <color> values like hex or rgb), but you will see it work anywhere CSS accepts an image: background, background-image, border-image, and even as a mask. This tool always outputs a background declaration for exactly that reason — it's the most common and most compatible place to apply a gradient.
Because a gradient is an image, you can also layer it with an actual photo using comma-separated background layers, or apply background-size and background-position to it just like any other background image. Once you think of a gradient as "a picture CSS paints for you from a formula" rather than as a special kind of color, a lot of its behavior — and its limitations — start to make more sense.
Color Stops and Positions Explained
Every gradient is defined by a list of color stops — a color plus, optionally, a position along the gradient's path. If you don't specify a position, CSS spreads the stops evenly; this generator always specifies explicit percentages so you have exact control. A stop at 0% sits at the very start of the gradient; a stop at 100% sits at the very end; anything in between blends smoothly from the stop before it to the stop after it.
With two stops you get a simple two-color blend. Add a third stop somewhere in the middle — say 50% — and the gradient blends from color one into color two by the midpoint, then from color two into color three by the end, creating a richer multi-tone transition. This is exactly what enabling Stop 3 or Stop 4 in the tool above does: it inserts another waypoint the gradient must pass through, and CSS handles all the smooth blending math between each pair of neighboring stops automatically.
Hard Stops: Turning a Blend Into Stripes
One of the more useful gradient tricks is the hard stop — placing two color stops at the exact same position. Normally CSS blends smoothly between adjacent stops, but when two stops share a position, there's zero distance for the blend to happen across, so the color changes instantly at that point instead of fading. Set Stop 2 and Stop 3 to the same percentage in this generator and you'll see the smooth gradient snap into a sharp, flat-color stripe boundary right at that position. Chain several stop pairs at matching positions and you can build striped backgrounds, flag-style color blocks, or segmented progress-bar effects — all without a single image file, using nothing but the gradient function itself.
Linear vs Radial vs Conic — Choosing the Right Type
The three gradient types paint color in fundamentally different shapes, and picking the right one changes what a design communicates:
- Linear gradients move color along a straight line at a given angle — 0deg points up, 90deg points right, 180deg points down, and so on. They're the most common choice for hero backgrounds, buttons, and subtle section dividers because the eye reads them as a directional flow.
- Radial gradients expand outward from a center point in concentric shapes, like a spotlight or a glow. They work well for drawing attention to a focal point — a call-to-action background, a card highlight, or a soft vignette effect around content.
- Conic gradients sweep color around a center point like the hands of a clock or a color wheel, rather than expanding outward. They're the natural choice for pie-chart-style visuals, color-wheel pickers, and circular progress indicators — shapes that a linear or radial gradient simply can't produce.
Switch the gradient type in this tool with the same color stops still set and you'll immediately see how differently each type reads the same colors — proof that the type isn't a minor styling detail but a real compositional choice.
Gradient Performance and Animating Gradients
A static CSS gradient is painted once and is generally inexpensive, so there is rarely a reason to avoid one. Animation is where to be careful. Gradients are painted as images, so animating the angle or a stop position directly makes the browser repaint on every frame, and in browsers that cannot interpolate the value it will simply jump. Test any animated gradient on a mid-range phone before you ship it.
Two patterns usually behave better: put the gradient on an oversized layer and animate that layer's transform, or stack two gradient layers and crossfade them with opacity. Both can be handled by the browser's compositor. Newer browsers also let you register a custom property with @property and animate it inside a gradient, but support and performance vary, so check your own browser targets before relying on it.
Arb Digital designs and builds websites for clients worldwide. If you want gradients, spacing and animation handled as part of a full design, see our web design service.
Web Design Services All Free ToolsWorked Example With the Default Inputs
Leave everything at its default: type Linear, angle 90, Stop 1 #1B3A6B at 0%, Stop 2 #E8A020 at 100%, Stops 3 and 4 unticked. The preview runs navy on the left to gold on the right, the result tile reads "Linear" with "2 color stops", and the textarea holds exactly:
background: linear-gradient(90deg, #1B3A6B 0%, #E8A020 100%);
Now tick "Use" on Stops 3 and 4 and change Stop 4 from 75 to 50. Stop 3 (navy) and Stop 4 (gold) now share the 50% position. The tool sorts the four stops and writes linear-gradient(90deg, #1B3A6B 0%, #1B3A6B 50%, #E8A020 50%, #E8A020 100%): a flat navy half and a flat gold half with a sharp edge between them. That is the hard-stop trick from above, produced with two clicks.
How to Read the Result
- The big label is the gradient type you picked. The line under it counts the active stops (2, 3 or 4), so you can confirm a ticked "Use" box actually took effect.
- The preview is the same value the textarea holds, applied to a 220px-high box. If the preview looks wrong, the pasted CSS will look wrong too.
- The textarea is a complete
backgrounddeclaration. Paste it inside a rule, or drop thebackground:prefix and the trailing semicolon if you need only the value. - Positions are percentages along the gradient line. For linear that is the line at your chosen angle (0deg points up, 90deg points right). For conic it is the fraction of a full turn, so 50% is half a circle.
Presets to Try
Each row shows the settings to change and the exact CSS the tool then writes.
| Preset | Settings | CSS output |
|---|---|---|
| Default blend | Linear, 90deg, stops as loaded | linear-gradient(90deg, #1B3A6B 0%, #E8A020 100%) |
| Hard split | Linear, 90deg, tick Stop 3 and Stop 4, set Stop 4 to 50% | linear-gradient(90deg, #1B3A6B 0%, #1B3A6B 50%, #E8A020 50%, #E8A020 100%) |
| Glow | Radial (angle ignored) | radial-gradient(circle, #1B3A6B 0%, #E8A020 100%) |
| Colour sweep | Conic, angle 90 | conic-gradient(from 90deg, #1B3A6B 0%, #E8A020 100%) |
What to Do Next
- Copy the CSS into the rule for your element and reload the page. A gradient on a full-width section often looks different from the 220px preview, so check it at real size.
- If text sits on top, check contrast against the lightest and darkest parts of the gradient with the color contrast checker.
- Add a plain
background-colorfallback above the gradient line if the element must stay readable when the image fails to load. - Need exact brand colours? Convert them first with the hex to RGB converter.
What This Tool Does Not Cover
- Radial output is always
circleat the centre, with no shape, size or position options. Conic output always starts from the centre. - There is no
repeating-variant, no transparency per stop (the colour pickers are opaque hex) and no colour-interpolation settings. - A blank angle or position field is outlined in red and the output waits until you enter a number. The inputs are limited to 0-360 degrees and 0-100%.
- Stops 3 and 4 start with preset colours and positions, so untick them if you want a plain two-colour blend.
Common Mistakes to Avoid
- Putting a gradient in the
colorproperty. Gradients are images, so they only work in image-accepting properties likebackground— notcolor,border-color, orbox-shadow's color. - Hand-writing stops out of order. This generator sorts your stops by position before it writes the CSS. In CSS you write by hand, a stop placed before the previous one is treated as if it sat at the previous stop's position, which creates an unplanned hard edge.
- Animating the gradient itself. Animating a gradient's angle or stops directly is expensive and often janky — animate a transform on a wrapping element instead.
- Low contrast between text and a busy gradient. If you're placing text over a gradient background, check contrast against the darkest and lightest parts of the gradient, not just one spot.
- Overusing conic gradients for simple backgrounds. Conic gradients are powerful for wheels and pies, but a plain linear gradient usually reads better for an ordinary section background.
Related Free Tools From Arb Digital
Pick your gradient colors precisely with the hex to RGB converter or the RGB to hex converter, and check any color combination for readability with the color contrast checker. Add depth around an element with the box shadow generator, round its corners with the border radius generator, or explore colors visually with the color picker & converter. Browse every tool at our free online tools hub.
Frequently Asked Questions
Because a CSS gradient is an image value, not a color value. It only works in properties that accept images, such as background or background-image. Use a plain hex, rgb or hsl value for the color property, and use a gradient function for background instead.
Set two color stops to the exact same position percentage. With zero distance between them, the gradient has no room to blend, so the color switches instantly at that point instead of fading, producing a sharp stripe boundary.
A linear gradient moves color along a straight line at a set angle. A radial gradient expands outward in rings from a center point, like a glow. A conic gradient sweeps color around a center point like a clock hand or color wheel, which linear and radial gradients cannot replicate.
Animating the angle or a stop position directly usually forces a repaint on every frame and may not interpolate at all in some browsers, because gradients are painted as images. A more reliable approach is to animate a transform or opacity on a wrapping element that carries the gradient, and to test on a mid-range phone.
No. linear-gradient, radial-gradient and conic-gradient are all supported without vendor prefixes in every current major browser. Prefixes like -webkit-linear-gradient were only needed for very old browser versions.
Yes — completely free, with no sign-up or usage limits. Every gradient is built locally in your browser with plain JavaScript; nothing you configure is stored or sent anywhere.