CSS Gradient Generator: Free Live Preview

CSS Gradient Generator

Create beautiful CSS gradients visually and copy the code.

90°
CSS

This CSS gradient generator lets you build linear, radial and conic gradients visually, adjust the angle, shape and color stops while watching a live preview, and copy the finished CSS in one click. It is made for developers and designers who want working background code without writing it by hand.

What Is a CSS Gradient?

A CSS gradient is an image the browser draws for you, a smooth blend between two or more colors, which you apply with the background property instead of loading an image file. Because it is generated by code, it scales to any size without blurring and adds no extra download.

Every gradient is built from color stops. A color stop is a color plus a position along the gradient line, written as a percentage. A gradient from blue at 0% to green at 100% has two stops, and the browser fills in every shade between them.

Linear, Radial and Conic Gradients

  • Linear gradients blend colors along a straight line. The angle sets the direction: 0 degrees points up, 90 degrees points right, 180 degrees points down and 270 degrees points left.
  • Radial gradients spread outward from a center point. The shape is either a circle or an ellipse that stretches to fit the box.
  • Conic gradients sweep around a center point like the hands of a clock. They are the usual choice for color wheels and pie-style graphics.

How to Use the CSS Gradient Generator

You can go from a blank preview to copied CSS in about a minute by following these steps.

  1. Choose a gradient from the Type menu: Linear, Radial or Conic. The preview at the top updates immediately.
  2. For Linear or Conic, drag the Angle slider anywhere from 0 to 360 degrees. For Radial, the angle control is replaced by Shape, where you pick Circle or Ellipse.
  3. Under Color Stops, click a color swatch to change that color, then drag its slider to move the stop between 0% and 100%.
  4. Click Add Stop to insert another color. Use the small X beside a stop to remove it. Two stops always remain, so you cannot delete below that.
  5. Prefer a head start? Click a swatch under Presets: Sunrise, Ocean, Purple, Sunset, Forest, Fire, Cool Blue or Candy. Then fine-tune from there.
  6. Click Copy beside the CSS box and paste the declaration into your stylesheet, usually on the element you want to fill.

Worked Example: A Three-Color Banner Background

Say you want a left-to-right banner that moves from blue through teal to green. Load the Cool Blue preset, which uses three stops: #2196F3 at 0%, #00BCD4 at 50% and #4CAF50 at 100%. Keep the type on Linear and the angle at 90 degrees.

The CSS box then shows a background declaration along the lines of linear-gradient(90deg, #2196F3 0%, #00BCD4 50%, #4CAF50 100%). The browser paints pure blue at the left edge, pure teal exactly in the middle and pure green at the right edge.

Now drag the angle to 180. The same colors run from top to bottom, which suits a tall sidebar better. Move the middle stop from 50% to 30% and the teal band shifts left, so green takes over more of the box. Small position changes like this are the fastest way to tune the mood without touching the colors.

How Do You Read and Act on the Results?

The preview and the CSS box always match, so the preview is your quality check and the code is your deliverable. Use the table below to decide which control to adjust when something looks off.

What you seeLikely causeFix
Gradient runs the wrong wayAngle is offDrag Angle until the direction matches
Muddy, gray middleOpposite hues blendAdd a stop with a brighter middle color
One color dominatesStops sit close to one edgeMove positions toward 0% and 100%
Hard line instead of a blendTwo stops share a positionSeparate them by 10% or more

What a Good Gradient Looks Like

Most polished interface gradients use two or three stops with colors that are close in hue, such as the Ocean or Purple presets. They look intentional and keep text readable. Gradients with four or more saturated stops can look busy, so add them only when the design truly calls for it.

If text sits on top, check contrast at the lightest and darkest parts of the gradient, not only the average. WCAG guidance asks for a 4.5:1 contrast ratio for normal body text, and a gradient can pass in one corner and fail in another.

Using a Hard Stop on Purpose

Two stops at the same position create a sharp edge instead of a blend. Set one stop to 50% and the next also to 50% and you get a clean split, handy for two-tone backgrounds and stripes.

Who Is This Tool For?

The generator suits anyone who needs gradient CSS faster than they can write and test it by hand. Typical situations include:

  • Front-end developers building hero sections, buttons, cards and badges who want to preview before committing code.
  • Designers moving a mockup into CSS and needing the exact angle and stop positions.
  • Bloggers and site owners who want a colored header or call-to-action strip without uploading an image.
  • Students learning how angles, shapes and stop percentages change the output, since the code updates as you drag.
  • Dashboard builders using conic gradients for simple dial or pie-style visuals and radial gradients for soft glows behind cards.

Best Practices, Common Mistakes and Troubleshooting

Most gradient problems come from how the CSS is applied, not from the gradient itself. These are the cases people run into most.

Why does the gradient not show up?

A gradient is a background image, so it will not work on properties that expect a plain color, such as color or background-color. Paste the copied declaration onto a background property of an element that has a width and height. An empty inline element with no size paints nothing.

How do you make a gradient transparent?

The color pickers choose solid colors, so there is no opacity slider. To fade out, paste the code and replace one hex value with an rgba() color or the keyword transparent. For the cleanest fade, use the same color with zero alpha, for example rgba(102, 126, 234, 0), so the middle does not turn gray.

How do you make gradient text?

Apply the copied gradient to the text element, then add background-clip: text and make the text color transparent. Many browsers also need the prefixed version of the clip property, so test in the browsers you support.

Can you make a gradient border or an animated gradient?

For borders, the common approach is a gradient as border-image or a gradient layered behind a padded inner box. Browsers cannot smoothly transition between two gradients, so for motion, enlarge the background size and animate its position. You can build that kind of movement with the CSS animation generator.

Using the output with Tailwind

If your project uses Tailwind, you can place the gradient inside an arbitrary background value and replace spaces with underscores. Alternatively, put the declaration in a custom class in your stylesheet.

Keep a solid fallback color

Add a plain background-color line before the gradient, using one of your stop colors. If the gradient fails to load for any reason, the element still has a readable background.

Limitations to Know About

This generator focuses on the core gradient controls. You choose the type, angle or shape, and a list of color stops, but there are no sliders for the center point or size of a radial gradient, and it does not extract colors from an uploaded image. If you need a different center, edit the copied CSS by hand, for example by adding at top left to a radial gradient.

Colors display slightly differently across screens and color profiles, so check the final result on the devices your visitors use. Very large, smooth gradients between similar colors can show faint banding on some displays, which you can reduce by adding a middle stop with a slightly different hue.

Related Tools for Your Stylesheet

Gradients rarely work alone. Pair a gradient background with depth from the CSS box shadow generator, or style headings placed over it with the CSS text shadow generator. Once your styles are done, shrink the file with the CSS minifier. If the gradient is part of a responsive design, the CSS media query generator helps you swap angles or colors at different breakpoints. More utilities live in the web developer tools collection.

Pick a type, drag the angle, set your color stops and copy the code. Use the generator on this page to build your next background and see the exact CSS before it reaches your project.

Frequently Asked Questions

What is a CSS gradient?
A CSS gradient is a browser-generated image that blends two or more colors smoothly. You apply it through the background property instead of loading a picture. The three main kinds are linear, radial and conic, and each is built from color stops with positions from 0% to 100%.
How do I make a CSS gradient background with this generator?
Choose a Type, adjust the Angle or Shape, set your colors under Color Stops, then click Copy. Paste the copied declaration onto the background of any element that has a size. The live preview shows exactly how the gradient will look.
Can I make a CSS gradient with 3 colors?
Yes. Click Add Stop to insert a third color, then drag its slider to set where it sits. The Cool Blue preset already uses three stops at 0%, 50% and 100%. You can remove extra stops, but two always stay.
Can I make a CSS gradient transparent?
The color pickers choose solid colors, so transparency is added after copying. Replace a hex value in the CSS with an rgba color or the transparent keyword. Using the same color at zero alpha gives the cleanest fade without a gray middle.
Can I use the generated gradient for text?
Yes, with two extra lines. Apply the copied gradient to the text element, then add background-clip set to text and a transparent text color. The generator supplies the gradient code, and you add those lines in your stylesheet.
Is the CSS gradient generator free to use?
Yes. The CSS gradient generator is free and needs no sign-in. You can switch between Linear, Radial and Conic types, try the eight presets, adjust color stops and copy the CSS as often as you like.
Recommended

Explore VPN options

A VPN changes your network exit. It does not guarantee anonymity.

Hide Your IP Encryption Network coverage
Protect My IP Now