Gradients are the texture of modern interfaces — hero backgrounds, buttons, overlays and brand moments — but writing gradient CSS by hand means visualising colour stops and angles from numbers, which nobody does well. This generator makes it visual: pick two or more colours, drag their positions along the gradient, set a direction or angle, and watch the preview update live. Linear gradients are the workhorse; a radial mode covers glows and spotlight effects. When it looks right, copy the generated background CSS — including a solid fallback colour for older rendering paths — straight into your stylesheet.
Quick Answer: Choose colours and stops, set the direction, preview live, and copy clean CSS gradient code for your design.
Free Online Tool
CSS Gradient Generator
Blend colours visually — copy the CSS when it sings.
How to Use the CSS Gradient Generator
- Start with two colours; add more stops if your design needs a richer blend.
- Adjust each stop’s position to control where colours change.
- Pick a direction preset or enter an exact angle in degrees.
- Switch to radial if you are building a glow or spotlight instead of a sweep.
- Copy the CSS and paste it into your stylesheet or style block.
Key Features
- Multi-stop linear gradients with per-stop colour and position control.
- Direction presets (to right, to bottom, diagonals) plus exact angle entry.
- Radial gradient mode for glows and focal effects.
- Live full-size preview as you design.
- Copy-ready CSS with a solid fallback background colour.
Best Practices and Tips
- Two colours from the same family (a deep and a light version of one hue) give the most professional results; rainbow blends rarely age well.
- Add a mid stop to soften a harsh transition — gradients band visibly when two contrasting colours meet abruptly.
- For text overlays, darken one end of the gradient where the text sits rather than the whole image.
- Check your gradient behind real content, not just alone; contrast over the busy end decides readability.
- Note the exact stop values for your brand gradients so every designer reproduces the identical blend.
Common Mistakes to Avoid
- Using a gradient as a substitute for a colour scheme — five unrelated hues signal indecision, not energy.
- Placing low-contrast text across a gradient whose light end makes it unreadable.
- Forgetting mobile: a wide desktop gradient may crop awkwardly on a tall phone screen — preview in both orientations.
- Animating gradient positions heavily, which can jank on low-powered devices; transition opacity of layered gradients instead.
Frequently Asked Questions
What is the difference between linear and radial gradients?
A linear gradient blends colours along a straight line at the angle you set — the classic sweep. A radial gradient radiates outward from a centre point in a circle or ellipse, perfect for glows, vignettes and spotlight effects. Both are generated here.
How many colour stops should I use?
Two is enough for most interface work; three gives richer control over the middle of the blend. Beyond four or five, gradients tend to look muddy unless each stop is chosen deliberately from one colour story.
Will the CSS work in all browsers?
Yes — linear and radial gradients in this standard syntax are supported by every modern browser. The generated code includes the first colour as a plain background fallback, so even an ancient renderer shows a sensible solid colour.
Can I make a gradient from an image’s colours?
Pair this with the Image Color Picker on this site: sample the key colours from your image there, then enter those hex values as stops here for a gradient that belongs to the picture.
What angle should I choose?
90deg (left to right) and 180deg (top to bottom) are the safe classics. Brand work often uses 135deg for a dynamic diagonal. The direction presets cover the common eight compass points; the angle box is there for exact brand specifications.
Related Tools
- CSS Box Shadow Generator – designs layered box shadows with sliders and presets
- Hex/RGB Color Converter – translates colours between hex, RGB and HSL with a live swatch
- Color Contrast Checker – tests colour pairs against WCAG accessibility contrast standards
- Image Color Picker – samples exact colours from images and extracts a palette