CSS radial gradient

Build a CSS radial-gradient: circle or ellipse, center and stops, with real output and a repeating example.

loading CSS radial gradient
About this tool

CSS radial gradient: how it works

A radial-gradient blends colors outwards from a center point, in a circle or an ellipse. The first stop is at the center and the last one at the edge of the shape, whose size by default reaches the farthest corner of the box. It is the tool for highlights, glows, vignettes, soft backgrounds and buttons with a light spot. This page opens the generator on the "spotlight" preset.

A real result

background: radial-gradient(circle at 50% 50%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%);

Tailwind:

bg-[radial-gradient(circle_at_50%_50%,_#ffffff_0%,_#6366f1_60%,_#1e1b4b_100%)]

Circle or ellipse

A circle keeps its shape whatever the box; an ellipse stretches to the box, which is the CSS default when no shape is given. On a wide banner the same gradient looks different:

background: radial-gradient(ellipse at 50% 50%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%);

Where the center is

CenterCSSUse
50% 50%radial-gradient(circle at 50% 50%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%)centered: a spotlight or a vignette
0% 0%radial-gradient(circle at 0% 0%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%)top-left corner: light from a corner
100% 0%radial-gradient(circle at 100% 0%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%)top-right corner
30% 70%radial-gradient(circle at 30% 70%, #ffffff 0%, #6366f1 60%, #1e1b4b 100%)off-center: a glow behind a card

Repeating rings

repeating-radial-gradient repeats the stops until the shape is full. Three stops 20% apart give concentric rings:

background: repeating-radial-gradient(circle at 50% 50%, #141413 0%, #ffb224 10%, #141413 20%);

Common mistakes

  • Putting the last stop at 100% and expecting it at the edge of the box: with the default size the 100% is the farthest corner, so the visible end of the gradient looks cut. Use 70 to 80% for the last color on a wide box.
  • Layering a glow over content without pointer-events: none: a pseudo-element with the gradient above the text blocks clicks.

How to use the generator

  1. Choose the radial type (the "spotlight" preset is already a radial gradient) and circle or ellipse.
  2. Move the center with the X and Y sliders and edit the stops.
  3. Copy the CSS or the Tailwind class.

Frequently asked questions

How do I make a spotlight or vignette with CSS?

Use a radial-gradient with a transparent center and a dark edge for a vignette, or a light center fading to transparent for a spotlight, layered over the content or the image.

Can I use more than one gradient on an element?

Yes: background accepts a comma-separated list, painted from the first (on top) to the last. Combine a radial glow over a linear gradient.

What does "at 50% 50%" mean?

The position of the center, as a percentage of the box: 50% from the left and 50% from the top is the middle. It is what the X and Y sliders set.

Report a problem