CSS Gradient Generator

Create stunning linear, radial and conic CSS gradients with a live preview. Copy CSS or Tailwind code in one click — completely free.

Colour Stops

Gradient Type

135°

How to Use This CSS Gradient Generator

Pick your colours using the colour swatches, drag the sliders to position each colour stop, and choose your gradient type — linear, radial, or conic. The live preview updates instantly so you can see exactly what your gradient will look like on a real element. When you're happy with the result, switch between CSS and Tailwind output, then click Copy Code and paste it straight into your project.

Understanding CSS Gradient Types

Linear Gradients

A linear gradient creates a colour transition along a straight line. You define the direction with an angle — 0deg goes upward, 90deg goes to the right, and 180deg goes downward. Diagonal angles like 135deg are popular in modern design because they create a dynamic, flowing feel. Linear gradients are the most widely used type and work brilliantly for page backgrounds, hero sections, buttons, and card overlays.

The CSS syntax is straightforward: background: linear-gradient(135deg, #667eea, #764ba2);. You can add as many colour stops as you need, and control exactly where each colour begins and ends by specifying percentage positions.

Radial Gradients

A radial gradient transitions colours outward from a central point. You can choose between a circle or ellipse shape, and position the centre anywhere on the element. Radial gradients are excellent for spotlight effects, glowing elements, soft vignettes, and creating the illusion of depth in your designs.

The syntax uses radial-gradient() instead of linear-gradient(), with the shape specified before the colour stops: background: radial-gradient(circle, #667eea, #764ba2);.

Conic Gradients

A conic gradient sweeps colour transitions around a central point, similar to the hands of a clock. Created with conic-gradient(), they are useful for pie charts, colour wheels, gauges, and creative decorative effects. The starting angle can be customised with the from keyword, e.g. conic-gradient(from 90deg, red, blue).

Tips for Creating Beautiful Gradients

Stick to two or three colours for clean, professional results. Colours that sit adjacent on the colour wheel — known as analogous colours — produce the smoothest transitions. If you want bold, energetic gradients, try complementary colours that sit opposite each other on the wheel. Adjusting the colour stop positions gives you fine control: pulling stops closer together creates a sharper transition, while spreading them apart produces a gentler blend.

For a more natural feel, avoid pure black and white as gradient endpoints. Instead, use very dark or very light tints of your primary colours. This keeps the gradient feeling rich rather than flat. You can also use the transparent keyword as a colour stop to create fade-in and fade-out effects — particularly useful for overlaying gradients on images.

Using Gradients in Tailwind CSS

If your project uses Tailwind CSS, you can apply gradients using utility classes. Use bg-gradient-to-r for left-to-right, bg-gradient-to-br for top-left to bottom-right, and so on. Then specify colour stops with from-[colour], via-[colour], and to-[colour]. For custom hex colours, use Tailwind's arbitrary value syntax, e.g. from-[#667eea]. This generator outputs the correct Tailwind classes automatically.

Related CSS Design Tools

Frequently Asked Questions

What is a CSS gradient?
A CSS gradient is a smooth, code-generated transition between two or more colours applied as a background image. Unlike image files, CSS gradients are rendered natively by the browser — making them resolution-independent, fast-loading, and easy to customise. The three main types are linear-gradient(), radial-gradient(), and conic-gradient().
How do I use a CSS gradient on my website?
Copy the generated code from this tool and paste it into your stylesheet. Apply it to any HTML element using the background or background-image property. For example: background: linear-gradient(135deg, #667eea, #764ba2);. No images are needed, which means faster load times and sharper rendering at any screen resolution.
What is the difference between linear and radial gradients?
Linear gradients transition colours along a straight line at a specified angle or direction (e.g. left to right, or diagonally). Radial gradients expand outward from a centre point in a circular or elliptical shape. Linear gradients are more common for large backgrounds and headers, while radial gradients are great for spotlight effects, glowing buttons, and creating depth.
Can I use more than two colours in a CSS gradient?
Yes. CSS gradients support any number of colour stops. Each stop specifies a colour and its position along the gradient line. This tool lets you add up to 5 colour stops, but in raw CSS there's no practical limit. More stops give you finer control over the transition.
Are CSS gradients supported in all browsers?
Yes. Linear and radial gradients have been fully supported in all major browsers (Chrome, Firefox, Safari, Edge, Opera) since around 2012. Conic gradients are supported in all browsers released since 2020. No vendor prefixes are needed for any current browser version.
How do I create a gradient in Tailwind CSS?
Tailwind provides utility classes for gradients. Use bg-gradient-to-r for direction (r, l, t, b, tr, tl, br, bl), then from-[colour], via-[colour], and to-[colour] for your colour stops. For custom hex colours, use arbitrary values like from-[#667eea]. This generator produces the correct Tailwind classes automatically.
What is a conic gradient?
A conic gradient sweeps colour transitions around a central point, like the sweep of a clock hand. Created with conic-gradient(), they're useful for pie charts, colour wheels, gauges, and decorative effects. You can set a starting angle with the from keyword.
How do I make a gradient with transparency?
Use rgba() or hsla() colour values with an alpha channel, or use the transparent keyword as a colour stop. For example: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)) creates a fade from fully transparent to solid red. This is great for overlaying gradients on images.
Can I animate a CSS gradient?
Standard CSS transitions don't work directly on gradients. However, you can animate them using the @property CSS rule to register custom properties as colours, allowing smooth transitions. Alternatively, create an oversized gradient and animate background-position to create a shifting effect.
What is the best angle for a CSS gradient?
It depends on your design, but popular choices include: 135deg (top-left to bottom-right diagonal — feels modern and dynamic), 90deg (left to right), 180deg (top to bottom — the default), and 45deg (diagonal upward). Diagonal angles generally feel more energetic than horizontal or vertical ones.