Color Gradient Generator
Create linear or radial gradients from two colors and get the CSS code instantly. Adjust rotation and stop position while the preview updates live.
Your Color Gradient Generator
Color 1
Color 2
0 %
90 deg
What this tool does
You want a colour that fades into another, a background that shifts from one tone to the next, a smooth blend across a banner or a button. Writing a gradient by hand means remembering the CSS syntax and fiddling with colour stops and angles until it looks right, which is slow and easy to get wrong.
That is what this does. You choose the colours you want and the direction, and it builds the gradient and gives you the CSS code to use it, with a live preview as you go. It turns a couple of colours into a ready-made smooth transition, so you get a polished gradient and the code behind it without wrestling with the syntax yourself.
How to use it
- Choose your colours. Set two or more colours for the gradient, in any common format or with the picker.
- Set the direction. Choose which way the gradient runs, and its type, such as a straight line or a radial spread.
- Copy the CSS. Take the generated gradient code to drop straight into your stylesheet.
Pick your colours, set how the gradient should run, and copy the CSS, adjusting the colours or direction until the preview looks the way you want.
How it works
A gradient is a smooth run from one colour to another, built by filling in all the shades in between. The tool takes your chosen colours as the stops, the fixed points along the way, and produces the transition that blends from one to the next. The colour blending can draw on chroma.js to keep the steps even, and the result is written as standard CSS.
The direction and type decide how that transition is laid out. A linear gradient runs the colours along a straight line at the angle you set, while a radial one spreads them outward from a centre. Either way the browser draws the in-between shades for you from the CSS, so the code stays short even though the gradient itself is a continuous sweep of colour.
What a gradient is
A gradient is a gradual blend between colours rather than a flat fill. Instead of one solid colour, an area moves smoothly from one colour to another across its length, passing through every shade in between. A sunrise sky, fading from warm near the horizon to deep blue above, is a gradient in nature.
What defines a gradient is its colour stops and its direction. The stops are the colours you want it to hit, and the direction is the path it takes between them. With two stops the gradient simply runs from the first colour to the second; with more, it passes through each in turn. Everything between the stops is filled in automatically, which is what gives a gradient its characteristic smoothness.
The CSS it gives you
The output is a piece of CSS you can paste straight into a stylesheet, written as a background gradient. It names the type, the direction, and the colour stops, and the browser does the rest, drawing the full blend from just those few values. You do not have to generate any images; the gradient is drawn live by the browser from the code.
That is one of the nice things about a CSS gradient: it is compact and it scales. Because the browser draws it, the gradient stays crisp at any size and adds almost nothing to page weight, unlike a gradient saved as an image. The tool gives you this code ready to use, so you get a resolution-independent gradient with a single copy and paste.
Why use a gradient
Gradients add depth and interest that a flat colour cannot. A background that shifts subtly from one tone to a near neighbour feels richer than a single fill, and a bold gradient across a hero section or a button can give a design a modern, energetic look. They are a simple way to make a plain area feel considered.
They are also useful for guiding the eye and setting mood. A gradient can lead a viewer from one part of a layout to another, or lend warmth or calm through the colours it moves between. From soft, barely-there background blends to vivid multi-colour sweeps, gradients turn up everywhere in modern design, which is why having a quick way to build them and grab the code is so handy.
Getting a smooth gradient
The main thing that makes a gradient look good is how cleanly its colours blend. Colours that sit near each other in hue transition smoothly, giving a soft, pleasing fade. Colours far apart can pass through a dull or muddy patch in the middle, the same greyer territory that catches out plain mixing, which can leave a visible band of an unwanted tone partway across.
If a gradient looks off in the middle, the usual fixes are to choose colours closer together, or to add a stop in between to steer the blend through a colour you do want. Keeping the colours in the same family, or bridging them with a well-chosen midpoint, keeps the whole run smooth. Watching the preview as you adjust is the surest way to catch a muddy middle before you copy the code.
Questions people ask
How do I make a gradient?
Choose your colours and set the direction, and the tool builds the gradient and gives you the CSS code, with a live preview as you adjust.
Do I get CSS code?
Yes. The output is a CSS background gradient you can paste into a stylesheet, and the browser draws the full blend from it, so no image is needed.
What types of gradient can I make?
Commonly a linear gradient, running the colours along a line at an angle, or a radial one, spreading them outward from a centre. You set the type and direction.
Why does my gradient look muddy in the middle?
Usually because the colours are far apart, so the blend passes through a dull patch. Use closer colours, or add a stop in between to steer it through a better tone.
References
- World Wide Web Consortium (W3C), CSS Color Module Level 4. https://www.w3.org/TR/css-color-4/
- Color gradient, a gradual blend between colours. Wikipedia. https://en.wikipedia.org/wiki/Color_gradient
- chroma.js (Gregor Aisch). Documentation. https://gka.github.io/chroma.js/
Bibhushan Saakha is a UI/UX developer with experience in design systems, Figma, Adobe Illustrator, and interface focused visual thinking. He had a strong eye for clarity, contrast, layout, and visual usability, and also holds a national record in blindfolded cube solving. At Eon Tools, he reviews color and QR tools.
Other Tools
- Brand Color Generator
- Bright Color Generator
- Change Color Hue
- Color Blind Test
- Color Blindness Simulator
- Color Chart
- Color Chart for Kids
- Color Extractor
- Color Inverter
- Color Mixer
- Color of the Year - Pantone
- Color Picker
- Color Wheel
- Complimentary Color Wheel
- Crayon Color Generator
- Darken Color
- Desaturate Color
- Dull Color Generator
- Gray Color Generator
- Image Color Inverter
- Image Color Picker
- Lighten Color
- Material Color Generator
- Pastel Color Generator
- Random Color Generator
- Random Color Name Generator
- Random Crayola Color Generator
- Saturate Color
- What Color Is This