CSS Gradient Generator
Pick a gradient type, choose two to four colours with a position for each, set the angle or the centre point, and copy the CSS. The code comes out ready to paste into a stylesheet, a style attribute or a site builder's custom CSS box. There is no preview pane here, so the guide below explains what each setting does to the picture.
What you enter
- Gradient type
- Angle
- Radial shape
- Centre point
- Colour 1
- Position 1
- Colour 2
- Position 2
- Add a third colour
- Colour 3
- Position 3
- Add a fourth colour
- Colour 4
- Position 4
- Repeating
- Add a solid fallback colour
How it works
- Choose the type: linear runs along a straight line, radial spreads out from a point, and conic sweeps around a point like the face of a clock.
- Set the colours. The first two stops are always on; tick the extra boxes to add a third or fourth colour. Each stop has a position from 0% to 100%.
- Set the angle for linear and conic gradients, or the shape and centre for a radial one. Tick Repeating if you want the stops to tile.
- Copy the CSS text and paste it into the rule for the element you want to colour.
How colour stops work
A gradient is a list of colour stops. Each stop is a colour and a position along the gradient line, written as a percentage. The browser blends smoothly from one stop to the next. With stops at 0% and 100%, the whole gradient is one long blend. Add a middle stop at 50% and you control the colour exactly at the centre.
If the first stop is above 0%, the area before it is filled with that first colour; the same goes for the last stop below 100%. That lets you make a gradient that holds a solid colour for the first third of a box and only then starts to change.
Choosing the shape
Linear gradients suit page backgrounds, banners and buttons, because the direction can follow the layout: a diagonal at 135 degrees gives a lively feel, while 180 degrees gives a gentle top to bottom fade. Radial gradients work well as a soft glow behind a product image or a headline, with the centre set where the eye should land.
Conic gradients are the least common and the most distinctive. With hard stops they make pie charts and colour wheels; with soft stops and subtle colours they make a metallic sheen. The repeating option tiles the stops, so a pattern that finishes at 20% repeats five times across the box.
Keeping gradients readable
The most common mistake is placing white text on a gradient whose light end fails contrast. Test the text against the lightest colour in the gradient, not the average. If one end fails, darken that colour, move its stop further away from the text, or put the text on a solid panel.
Banding, where you can see steps instead of a smooth blend, shows up when two colours are very close and the area is large. A slight difference in brightness plus a mid stop in a different hue usually hides it.
Tips
- Two colours that sit close together on the colour wheel, such as blue to violet, blend cleanly. Colours on opposite sides, such as red to green, often turn muddy grey in the middle.
- Stops are sorted by position in the output, so you can enter the colours in any order and the code still reads from 0% to 100%.
- Put text over a gradient only after you have checked contrast against both the lightest and the darkest part of it.
- For a hard edge instead of a blend, give two stops the same position, for example one colour at 50% and the next colour also at 50%.
- A soft, low-contrast gradient behind a section looks more professional than a loud one. Keep the two colours within a few shades of each other.
Frequently asked questions
What is a CSS gradient?
A CSS gradient is an image that the browser draws for you from a few colours, so it needs no file download and stays sharp at every size. You use it anywhere CSS accepts an image, most often as a background.
What is the difference between linear, radial and conic?
A linear gradient changes colour along a straight line at the angle you choose. A radial gradient changes colour with distance from a centre point, in a circle or an ellipse. A conic gradient changes colour with the angle around a centre point, which is how colour wheels and pie charts are drawn.
How do the angles work?
In a linear gradient, 0 degrees runs from bottom to top, 90 degrees from left to right, 180 degrees from top to bottom and 135 degrees from the top left corner to the bottom right. In a conic gradient the angle is where the sweep starts, measured clockwise from the top.
Why is there a solid fallback colour option?
Every current browser draws gradients, so the fallback is rarely needed. If you tick it, the code first sets a plain background-color equal to your first stop, which shows if a gradient cannot be drawn.
Can I use the code in any website?
Yes. The output is standard CSS. Paste it inside a rule such as .hero { ... }, or into a style attribute on an element.
Related: CSS shadow generator, Hex colour picker, Colour contrast checker.
Start a 7-day free trial or see all free tools. On We.Inc you get a 7-day free trial, not a free plan: card needed, $0 today, cancel before it ends and you pay nothing. AI building is on paid plans from $20 a month.
More in Free Tools
- CSS Grid Generator
- Flexbox and CSS Layout Generator
- CSS Minifier
- CSS Box Shadow Generator
- CSS Specificity Calculator
- CSS Text Shadow Generator
- CSS to Tailwind Converter, Both Directions
- CSS Tooltip Generator
Related guides
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App