Free CSS Gradient Online

Make linear, radial and conic CSS gradients with unlimited stops, drag handles, opacity, repeating patterns and OKLab/OKLCH blending. Copy CSS with a fallback.

No login. Files processed for your request and discarded. Free to use. Files processed & discarded →

Compress PDF — it's free or choose from 130+ tools

130+ Free Tools
— Files Processed
— Happy Visitors
— Pages Explored
0 Files Stored

CSS Gradient Generator

Part of Text tools: See all Text tools.

What is CSS Gradient?

A free CSS gradient generator for linear, radial and conic gradients and their repeating versions. Add up to 50 colour stops, drag them on a bar, set each stop's opacity, choose sRGB, OKLab or OKLCH blending, and copy background-image CSS with a solid fallback colour. It runs in your browser.

How to use CSS Gradient

  1. Pick a preset or start with the default two colours.
  2. Choose Linear, Radial or Conic.
  3. Set each stop's colour and opacity; drag the handles under the bar to move stops, or click the bar to add one.
  4. Set the angle or direction, or the shape, size and centre for radial and conic gradients.
  5. Choose the colour format and blending, then click Copy CSS.

Why use this tool?

Many gradient tools stop at two colours or one gradient type. This one handles all three CSS gradient functions, hard stops for stripes and pie charts, transparency for image overlays and the newer OKLab and OKLCH blending, and it always writes an sRGB fallback line so older browsers still show a gradient. Files are processed for your request and discarded.

FAQ

What is the difference between linear, radial and conic gradients?
A linear gradient blends along a straight line at an angle, a radial gradient spreads outward from a centre point as a circle or ellipse, and a conic gradient sweeps round a centre like a clock hand, which is how colour wheels and pie charts are made in CSS.
How many colour stops can I add?
Up to 50. Click the stop bar to add one at that point, use + Add stop to fill the biggest gap, and remove any stop as long as two are left.
How do I make hard stripes instead of a smooth blend?
Put two stops at the same position with different colours; the browser draws a sharp line there. For a repeating pattern tick Repeating gradient and keep the last stop below 100%, for example 0%, 10%, 10% and 20%.
What do OKLab and OKLCH blending do?
They tell the browser to mix the colours in a colour space closer to how eyes see colour, so blends such as blue to yellow do not go grey in the middle. The CSS includes a plain sRGB line first, so browsers without support still show a normal gradient.
How do I put a gradient over an image?
Use the Dark image overlay preset or fade a stop to 0% opacity, copy the gradient value, and list it before the image: background-image: linear-gradient(...), url(photo.jpg). The gradient sits on top and keeps text readable.
Do I need -webkit- prefixes?
No. Current Chrome, Edge, Firefox and Safari all support the standard gradient syntax this tool writes, so vendor prefixes are not needed.
Is my design uploaded?
No. The gradient is built and previewed in your browser; the colours and settings are not sent to our server.

What this CSS gradient generator does

This page builds CSS gradients, the smooth colour blends you see behind hero sections, buttons, cards and image overlays, and gives you the code to paste into your stylesheet. It handles all three gradient functions in CSS: linear-gradient for a straight blend across the box, radial-gradient for a blend that spreads out from a point, and conic-gradient for a blend that sweeps round a centre like the hands of a clock. Each one also has a repeating version for stripes, rings and patterns.

You can use as many colour stops as you need, up to 50. Drag the round handles under the stop bar to move a stop, click anywhere on the bar to add a new one in the colour already at that point, and type a colour as hex such as #ff8800, rgb(), hsl() or a name like orange. Each stop has its own opacity slider, so fading to transparent for an overlay is one move. The preview and the CSS update as you go.

The output uses background-image, not the background shorthand, so it will not reset a background colour or image you have already set, and by default it adds a solid background-color first as a fallback. Everything runs in your browser. Nothing you make here is sent to our server.

How to make a gradient

  1. Start from a preset or keep the default indigo to pink blend.
  2. Choose the type: Linear, Radial or Conic.
  3. Set the colours. Use the colour picker or type a value in the text box next to each stop, and drag the opacity slider if you want it see-through.
  4. Move the stops by dragging their handles, typing a position in percent, or selecting the bar and using the left and right arrow keys (hold Shift to move 10% at a time). Press Delete to remove the selected stop.
  5. Adjust the angle or direction for a linear gradient, the shape, size and centre for a radial one, or the start angle and centre for a conic one.
  6. Pick a colour format for the output and, if you like, a colour blending mode.
  7. Click Copy CSS for the full declarations, or Copy gradient value only if you just need the linear-gradient(...) part, for example for a CSS variable or a border-image.

Linear, radial and conic: which to use

Linear gradients are the everyday choice for page and button backgrounds. The angle works like a compass: 0deg points up, 90deg to the right, 180deg down. A direction keyword such as to bottom right instead aims at the corner, whatever shape the box is, which is usually what you want for full-width banners. Choosing a direction disables the angle slider, because the keyword sets the angle for you.

Radial gradients are good for spotlights, glows and vignettes. An ellipse stretches to the shape of the box, while a circle stays round. The size keyword decides where the 100% stop lands: farthest-corner, the default, reaches the corner furthest from the centre; closest-side stops at the nearest edge, which gives a tighter glow. Moving the centre with the X and Y sliders puts the light off to one side.

Conic gradients sweep colours round a centre point, so they make colour wheels, pie charts, loading spinners and starburst backgrounds. The start angle rotates where the sweep begins. For a pie chart, use hard stops: two stops at the same position make a sharp edge instead of a blend. The Conic pie chart preset shows the pattern with three slices of 40%, 30% and 30%.

Colour stops, hard edges and repeating gradients

A colour stop is a colour plus a position along the gradient. Between two stops the browser blends evenly; before the first stop and after the last one it holds that colour solid. That gives you a few useful tricks. Put two different colours at the same position and you get a hard line, which is how stripes, flags and progress bars are drawn. Space the stops unevenly to make one colour take up more room. Use Space evenly to spread them out again, and Reverse to flip the whole gradient.

Tick Repeating gradient to turn the stops into a pattern. A repeating gradient only repeats if the last stop is below 100%. The Repeating stripes preset uses stops at 0%, 10%, 10% and 20%, so the 20% band repeats five times across the box. The page shows a tip if you tick Repeating while your last stop is still at 100%, because then nothing would visibly change.

Transparency and image overlays

One of the most common uses of a gradient is darkening part of a photo so white text on top stays readable. The Dark image overlay preset goes from fully transparent black at the top to 80% black at the bottom. In your CSS, list the gradient before the image so it sits on top, for example background-image: linear-gradient(...), url(hero.jpg). For overlays the preset turns the fallback colour off, since a solid fallback would hide the photo in very old browsers.

To fade a colour out, drag its opacity slider down to 0 rather than switching it to another colour. Current browsers blend transparency correctly, so the keyword transparent also works, but a zero-opacity copy of the same colour gives exactly the edge you expect in every browser and in design tools that read your CSS.

Colour blending: sRGB, OKLab and OKLCH

By default browsers blend gradient colours in sRGB, the same space the hex codes are written in. It works everywhere, but some pairs blend badly: blue to yellow, for example, goes through a dull grey in the middle. Newer CSS lets you choose the colour space used for blending by adding in oklab or in oklch to the gradient. OKLab is designed so that equal steps look equal to the eye, which gives an even, less muddy middle. OKLCH keeps colours saturated by going round the hue circle, and longer hue sends it the long way round for a rainbow effect between two colours.

Current Chrome, Edge, Safari and Firefox support these, but older browsers do not. When you pick one, the CSS has two background-image lines: a plain sRGB version first and the OKLab or OKLCH version second. A browser that does not understand the second line ignores it and keeps the first, so nobody gets a blank background. If your own browser cannot show the new blending, the page says so and previews the sRGB version.

About the CSS this tool writes

  • Fallback colour: a solid background-color, the average of your stop colours, for the rare case where gradients are not drawn at all, such as some email clients. Untick Add fallback colour if you do not want it.
  • No vendor prefixes: -webkit- and -moz- gradient prefixes have not been needed in any supported browser for years, so they are left out. The syntax is standard CSS that works in current Chrome, Edge, Firefox and Safari.
  • Short output: default values such as ellipse farthest-corner at 50% 50% are left out, because the browser assumes them anyway.
  • Colour formats: hex output uses 8-digit hex (#rrggbbaa) for see-through stops, rgb() switches to rgba(), and hsl() values are rounded to one decimal place, which can shift a colour by one unit in rgb.

Tips for good-looking gradients

  • Neighbouring hues, such as blue to purple or orange to pink, usually look smoother than opposite ones. For opposites, try OKLab blending.
  • Keep text readable. Check the darkest and lightest part of the gradient behind your text with a colour contrast checker.
  • Subtle often works better than bold for large areas: two shades of the same colour a few steps apart give depth without distracting from the content.
  • Gradients are drawn by the browser, so they stay sharp on any screen and add no image download to your page.

Limits

The tool writes one gradient layer at a time; to stack several, generate each and join their values with commas in one background-image. Stop positions are in percent only, and it does not add colour hints (the optional midpoint between two stops) or export images. Stop colours are sRGB colours: hex, rgb(), hsl() and colour names work, but oklch(), lab() and display-p3 values are not accepted as stop colours (OKLab and OKLCH are available as blending modes).

Privacy

The gradient is built and previewed entirely in your browser with JavaScript. The colours and settings you choose are not uploaded or stored on our server.

Related tools

Pick or convert a single colour with the colour picker, check text against your background with the colour contrast checker, and shrink your finished stylesheet with the CSS minifier.

Also try

Related tools that work well with this one: