Skip to content
Media

CSS Gradient Generator

Design multi-stop CSS gradients with live preview and copy CSS.

cssgradientlinearradialdesign
Loading tool…

About the CSS Gradient Generator

The CSS Gradient Generator constructs multi-stop gradients and emits the exact background declaration you can paste into a stylesheet. Switch between Linear and Radial with the tabs, and for linear gradients an Angle slider sweeps from 0 to 360 degrees in 5-degree steps to control direction. Color stops are the heart of the tool: each row holds a color picker, a hex field, a numeric position from 0 to 100 percent, and a position slider, and sections are numbered in order. The Add stop button appends a new stop, colored emerald by default and placed a quarter of the way back from the previous last stop, while the remove button stays disabled until you hold more than the minimum two. Stops are sorted by position before rendering, so dragging them later reorders the gradient automatically. The preview panel paints a full-width swatch with the live gradient so color changes are visible immediately. The CSS result appears in a result box prefixed with the background property, ready for one-click copy or download as gradient.css. Radial gradients always emit circle at center, radiating from the middle of the element rather than along an angle.

CSS Gradient Generator examples

Input
Type Linear · Angle 135 · Stops: #7c3aed at 0% and #ec4899 at 100% (defaults)
Output
background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
Note: The two default stops combine with the 135-degree angle to produce the starter slide from violet to pink. Positions render as integers with the percent sign, and the output is wrapped in the background property for a one-line paste.
Input
Type Radial · Stops: #0ea5e9 at 0%, #10b981 at 50%, #ec4899 at 100%
Output
background: radial-gradient(circle at center, #0ea5e9 0%, #10b981 50%, #ec4899 100%);
Note: Radial output always emits circle at center regardless of the angle slider, radiating outward equally in every direction. The three stops create a sky-to-teal-to-pink center-out fade for a spotlight accent.
Input
Type Linear · Angle 90 · Stops added in the order #7c3aed at 0%, #10b981 at 100%, then #ec4899 at 50%
Output
background: linear-gradient(90deg, #7c3aed 0%, #ec4899 50%, #10b981 100%);
Note: Stops are sorted by position before output, so the entry order of #10b981 at 100 then #ec4899 at 50 is reordered into 0, 50, and 100 percent. Every position is clamped to the 0-100 range even if a number field was typed out of bounds.

How to use the CSS Gradient Generator

  1. 1

    Pick Linear or Radial from the tab strip at the top; radial mode hides the angle control and adds a short note about center radiation.

  2. 2

    Drag the Angle slider for the gradient direction in degrees; the hint shows the current value as you move it.

  3. 3

    Edit each Color stop's color with the picker or hex field, and set its position with the number input or the slider.

  4. 4

    Click Add stop to append another color row, or the trash icon to remove a stop while more than two remain.

  5. 5

    Copy the CSS from the result box or download it as gradient.css, then paste the background declaration straight into your stylesheet.

Common use cases

  • Landing page heroes — a diagonal linear gradient between two brand colors gives a header depth behind the headline and CTA.
  • CTA buttons — a tight two-stop gradient with strong contrast between stops makes the invite action feel tactile and clickable.
  • Section dividers — a soft radial fade from a light accent color into the page background transitions related blocks gracefully.
  • Social media banners — export a gradient as the base of cover art, then overlay text and icons in a consistent brand palette.
  • Marketing emails — a compact linear gradient keeps an intro block on-brand inside clients that ignore background images.
  • Product onboarding screens — radial gradients focus attention on a central illustration instead of scattering it across the screen.

Best practices

  • Keep stop positions monotonic by dragging them into order; the generator sorts automatically, but tidy input keeps the preview intuitive.
  • Clamp positions to the 0-100 range manually if you type values; out-of-range positions get clamped on render, so verify the preview.
  • Use radial gradients for spotlight effects over a background element and reserve linear diagonals for directional transitions.
  • Test any text overlaid on the gradient against the actual blend using the contrast checker, since mid-gradient colors are darker than either stop.
  • Limit a single gradient to three or four stops; more bands read as visual noise and awkward color compression in smooth transitions.
  • Copy the background property from the result box rather than retyping it, so the exact declaration ships into the stylesheet unchanged.

Tips

  • Save your most-used three-stop combinations from this tool into design tokens; they stay consistent across every page that reuses them.
  • Test the gradient against both light and dark text by pasting the two overlaid colors through the contrast checker before publishing.
  • Angles ending in 5 or 0 tend to read as intentional direction; off-angle values like 137 feel slightly organic in large hero panels.
  • After adding a stop at 75 percent as a midpoint, drag it slightly and re-copy; the output changes live, so recopy after every tweak.

Frequently asked questions

Linear gradients paint color perpendicular to a direction set by the angle, from one side of the element to the edge opposite it. Radial gradients radiate circle at center, spreading outward from the middle in all directions. That is why the angle slider belongs only to the linear tab.

The slider advances in 5-degree increments so precision stays high without endless fiddling, moving from 0 to 360 degrees across the full sweep. Common angles like 45, 90, and 135 all land neatly on the grid, and the hint label always shows the current value.

Yes. The Add stop button appends an extra row in emerald, so you can layer as many stops as the design needs. The remove button stays active only while more than two stops remain, enforcing the CSS minimum of two handles and preventing an empty gradient declaration.

No. The generator sorts all stops by their position before building the CSS, so the preview and the output always read from lowest to highest percentage. You can enter or drag them in any order and the emitted declaration reflects the sorted sequence automatically.

The position marks where along the gradient a color reaches its full intensity, with 0 percent at one edge and 100 at the other for linear, and 0 at the center outward for radial. Moving a stop reweights the blend between its neighbors, which the preview shows instantly.

The result box emits the full background declaration, like background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);, ready to drop into any rule. Add your own selector and braces around it, or download gradient.css containing the declaration to keep for reference.

Explore more media tools

Browse the full collection of media tools on the hub, or jump back to all categories.

Related tools

Did this tool help?

Anonymous — one tap, no sign-up.