CSS gradient generator

Build linear, radial and conic CSS gradients with as many color stops as you want, see them live on a light and a dark background and copy the CSS or

loading CSS gradient generator
About this tool

What is a CSS gradient generator?

A CSS gradient generator builds the linear-gradient(), radial-gradient() and conic-gradient() values you put in a background. You pick the type, the angle or the center, and as many color stops as you need. The page shows the result live and gives you the CSS to copy. It saves you from guessing angles and percentages by hand and from reloading a page after every small change.

The three types do different things. A linear gradient blends colors along a straight line at an angle you choose. A radial gradient spreads colors out from a center point, as a circle or an ellipse. A conic gradient sweeps colors around a center like a color wheel or a pie chart. Each one can also repeat as a pattern, which gives you stripes and rings.

The tool works with the values CSS writes, so you can paste an existing gradient and keep editing it. It keeps the opacity of each color stop and writes semi-transparent colors as rgba(). You can copy plain CSS or a Tailwind arbitrary-value class. Everything runs in your browser and nothing you paste is sent anywhere.

How to build a gradient

  1. Start from a ready-made point in "Starting points" (Sunset, Ocean, Aurora, Spotlight, Color wheel or Stripes), or paste your own CSS into "Paste CSS to edit it".
  2. Under "Type", choose Linear, Radial or Conic. Linear and conic use an angle ("Angle" or "Start angle"). Radial and conic also show "Center, horizontal" and "Center, vertical". Radial adds "Shape" (Circle or Ellipse).
  3. Tick "Repeat the pattern (repeating gradient)" if you want the stops to tile instead of filling the box once.
  4. In "Color stops", set each "Color", its "Position" in percent and its "Opacity". Use "Add a color stop" for more, and "Remove" to drop one. A gradient always keeps at least two stops.
  5. Use "Reverse" to flip the order of the colors and "Spread evenly" to place the stops at equal distances.
  6. Check the preview on the light and dark backgrounds.
  7. Choose "CSS" or "Tailwind" under "Format", then press "Copy CSS".

Examples

The default three-color gradient

With the default settings (Linear, 90 degrees, three stops) the result is:

background: linear-gradient(90deg, #ffb224 0%, #d946ef 55%, #3b82f6 100%);

Switch "Format" to Tailwind and the same gradient becomes a class, with every space replaced by an underscore:

bg-[linear-gradient(90deg,_#ffb224_0%,_#d946ef_55%,_#3b82f6_100%)]

Paste a gradient and edit it

Paste linear-gradient(to right top, #051937, #004d7a, #008793, #00bf72, #a8eb12). The direction to right top becomes 45 degrees, and the stops with no position are spread evenly, as the CSS spec says:

background: linear-gradient(45deg, #051937 0%, #004d7a 25%, #008793 50%, #00bf72 75%, #a8eb12 100%);

A value with no direction, such as linear-gradient(#000000, #ffffff), is read as 180 degrees, which is to bottom.

Hard stripes with a repeating gradient

Load the Stripes starting point. Two stops share each position, so the colors change with no blending:

background: repeating-linear-gradient(45deg, #141413 0%, #141413 10%, #ffb224 10%, #ffb224 20%);

The pattern repeats every 20 percent of the gradient line. Change the positions to make the stripes wider or narrower.

A spotlight and a color wheel

Radial: radial-gradient(circle at 50% 50%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%). Conic: conic-gradient(from 0deg at 50% 50%, #ef4444 0%, #f59e0b 20%, #22c55e 40%, #3b82f6 60%, #a855f7 80%, #ef4444 100%). Repeating the first color at the end closes the wheel with no visible seam.

Common mistakes

  • Pasting sizes the tool cannot edit. radial-gradient(closest-side, ...) or circle 40px are rejected with an error message. Use circle or ellipse and move the center instead.
  • Using units other than percent on stops. Stops need percentage positions. Pixel or em positions are not read.
  • Expecting two stops to blend when they share a position. Equal positions make a hard edge. This is how stripes work, so use it on purpose.
  • Forgetting the angle convention. 0 degrees points up and 90 degrees points right. to right and 90deg are the same direction.
  • Putting the gradient in background-color. A gradient is an image, so it belongs in background or background-image.
  • Removing the last two stops. A gradient needs at least two colors, so the "Remove" button is disabled at two.

Frequently asked questions

How do I make a gradient with transparency?

Lower the "Opacity" of a color stop. The tool then writes that color as rgba(), for example rgba(0, 0, 0, 0.5). This is useful for fading an image into a background.

What is the difference between linear, radial and conic?

Linear moves in a straight line, radial moves outward from a point, and conic rotates around a point. Use linear for backgrounds and buttons, radial for spotlights and glows, and conic for pie charts and color wheels.

Can I use the result in Tailwind?

Yes. Choose "Tailwind" under "Format" and copy the bg-[...] class. It is an arbitrary value, so it works in any project that has Tailwind. If you need the style as a React object, send the CSS to the CSS to React style converter.

Does it support color names and hsl()?

Yes. The pasted CSS can use hex, rgb(), hsl() and named colors. The tool converts them to hex, keeping the opacity. To pick or convert colors first, use the color converter.

Is my CSS uploaded anywhere?

No. The generator runs in your browser and nothing is sent to a server. For soft depth on the same element, try the box-shadow generator.

Report a problem