CSS generators

CSS Gradient Generator

Design linear, radial and conic gradients visually, with draggable color stops, modern color spaces and stacked layers, then copy clean CSS, Tailwind or Sass.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.
Colors change along a straight line at an angle.Colors spread outward from a center point in a circle or ellipse.Colors sweep around a center point, like a pie chart or color wheel.
Repeats the stop pattern to fill the box. Keep the last stop well below 100% (for example 10%) to see stripes or rings.
Undo (Ctrl/⌘+Z)Redo (Ctrl/⌘+Shift+Z)Randomize: surprise me with a new designReset to the starting designCopy a link that reopens this exact design

Preview

Live preview of every visible layer. For radial and conic layers, drag the center handle.
Checkerboard: shows exactly which parts are transparent.White background, like a light-mode page.Near-black background, to check the design in dark mode.Your own background color: test on the surface the design will really sit on.

Gradient

Edit the selected layer. Every change is live and undoable.

Color stops

Click the bar to add a stop. Drag a stop to move it; drag it off the bar or press Delete to remove it. Arrow keys nudge the focused stop.
Reverse the stopsSpace stops evenly
Any CSS color works: hex, rgb(), hsl(), oklch() or a name. Pasting rgba() or 8-digit hex also sets the opacity.
Opacity of this color. 0% is fully transparent.
%
Where this stop sits along the gradient. Put two stops at the same position for a hard edge.
%

Direction

CSS angles start at the top (0deg) and turn clockwise: 90deg points right.
AngleDrag the dial (hold Shift to snap to 15°), type a value, or focus it and use the arrow keys.
deg
0° (to top)45° (to top right)90° (to right)135° (to bottom right)180° (to bottom)225° (to bottom left)270° (to left)315° (to top left)

Interpolation

The color space the browser mixes colors in between stops. It changes the midpoints, not the stops. OKLab and OKLCH avoid the gray dead zone that sRGB produces between complementary colors.

Perceptually even steps with no gray dead zone and no surprise hues. The best default.

Layers (1)

Stack several gradients like CSS background layers. The top row paints on top, so upper layers need transparent stops to let lower ones show.
Add a layer on top
  • Hide layerMove layer up (paints above)Move layer down (paints below)Duplicate layerDelete layer
Paste existing CSS
Paste a gradient from a stylesheet, a design tool or another generator: a value, a declaration or a whole rule. Every layer becomes editable.Your code stays in this browser tab. It is not saved or uploaded.

Code

Plain CSS, with optional fallbacks for older browsers.Tailwind classes: an exact arbitrary value, plus v4 gradient utilities when the design fits them.Sass variables for every stop, ready for a design-token file.
Copy CSSDownload gradient.css
Adds a solid background-color and, when you use a modern color space or oklch() colors, an sRGB approximation that older browsers use instead.
Browsers that don't understand color-space interpolation skip the last declaration and keep the sRGB approximation above it, which is sampled from the same colors so it looks nearly identical.

Presets

One click applies a preset. Undo (Ctrl/⌘+Z) brings your previous design back.
  • Calm cyan to indigo. A safe, on-brand hero or button gradient.
  • Warm amber through pink to violet, interpolated in OKLCH for vivid midpoints.
  • Layered radial glows over a dark base: the modern 'aurora' hero background.
  • Four corner blobs on a warm base: a soft mesh gradient made of plain CSS layers.
  • A full hue wheel from just two red stops: conic + OKLCH + longer hue does the rest.
  • Hard stops in a repeating gradient: two stops share a position, so the edge is sharp.
  • A centered violet glow fading into a near-black page: great behind a product shot.
  • Deep navy to violet: a quiet, high-contrast backdrop for white text.
  • Fresh green to cyan in OKLCH: clean and bright for success states and SaaS heroes.
  • A repeating conic gradient makes retro rays with four stops.
  • Iridescent pastels, the foil look for cards and badges.
  • Blue to yellow in sRGB turns gray in the middle. Switch Interpolation to OKLCH or OKLab to fix it.

Want a site designed with this level of care? Talk to our team

Quick answer

A CSS gradient is an image the browser draws from color stops: linear-gradient() blends along a straight line, radial-gradient() spreads out from a point, and conic-gradient() sweeps around one. In Playxoft's free CSS Gradient Generator, pick a type, click the color bar to add stops, drag them into place and choose an interpolation color space such as OKLab, then copy the CSS, Tailwind class or Sass variables.

  • Linear, radial and conic
  • Draggable color stops
  • OKLab and OKLCH blending
  • Layered gradients
  • Fallbacks for older browsers
  • Paste existing CSS to edit
  • CSS, Tailwind and Sass
  • Undo, redo and share links

How to use the CSS Gradient Generator

  1. 1Choose Linear, Radial or Conic in the toolbar, or start from one of the Presets below the editor.
  2. 2Click the color bar to add a stop, drag stops to move them, and drag a stop off the bar (or press Delete) to remove it.
  3. 3Set the selected stop's Stop color, Opacity and Position. Two stops at the same position make a hard edge.
  4. 4Pick an Interpolation color space: OKLab for smooth, even blends or OKLCH for vivid sweeps around the hue wheel.
  5. 5Already have a gradient? Open Paste existing CSS in the controls and import it to keep editing every layer.
  6. 6Stack extra Layers for mesh-style backgrounds, then copy the CSS, Tailwind or SCSS tab, or press Share to copy a link to the design.

Linear vs radial vs conic gradients: which should I use?

All three are CSS <image> values, so they go anywhere an image does: background-image, border-image, mask-image and list-style-image. They differ in the path the colors travel along.

FunctionColors travelTypical usesKey syntax
linear-gradient()Along a straight line at an angleButtons, hero sections, overlays that darken an image for textlinear-gradient(135deg, …)
radial-gradient()Outward from a center, as a circle or ellipseGlows, spotlights, vignettes, soft "blob" shapesradial-gradient(circle at 30% 20%, …)
conic-gradient()Around a center, like a clock handPie charts, color wheels, loading rings, starburstsconic-gradient(from 90deg at 50% 50%, …)

Angles follow the CSS convention: 0deg points up and angles turn clockwise, so 90deg means "to right". Each function has a repeating- version that tiles the stop pattern, which is how stripes and rings are made without an image file.

How do CSS color stops work?

A color stop is a color plus an optional position along the gradient line. Stops without positions are spread evenly, and the first and last default to 0% and 100%. Between two stops the browser blends; before the first and after the last it holds the color flat.

/* Even spread */
background: linear-gradient(90deg, #3b82f6, #a855f7, #ec4899);

/* Hard edge: two stops share 50%, so there is no blend */
background: linear-gradient(90deg, #0ea5e9 50%, #f97316 50%);

/* Stripes with a repeating gradient */
background: repeating-linear-gradient(45deg, #facc15 0 10px, #18181b 10px 20px);

Three details trip people up:

  • Double positions like #18181b 10px 20px are shorthand for two stops of the same color, which is the cleanest way to write bands.
  • Transparent stops blend with premultiplied alpha in modern browsers, so fading #ec4899 to transparent no longer passes through gray. Using the same color at 0% opacity (#ec489900) is still the most predictable choice, and it is what this generator writes.
  • Color hints (a bare percentage between two stops, such as red, 30%, blue) move the midpoint of a blend without adding a color.

What does in oklch do, and why do gradients look muddy or banded?

The interpolation color space decides how the browser mixes two stops. If every stop is a legacy color (hex, rgb(), hsl() or a name), the browser blends in sRGB; if any stop uses a modern syntax such as oklch() or lab(), the default becomes OKLab. sRGB mixes channel numbers rather than perceived color: blue to yellow passes through a dull gray in the middle (the "dead zone"), and red to green meets in a dark olive. CSS Color Module Level 4 lets you choose the space with an in clause.

ClauseHow it mixesUse it for
(none) / in srgbRaw sRGB channel valuesMatching older designs exactly
in srgb-linearPhysical light, before gammaLight-like blends with bright midpoints
in oklabPerceptually uniform lightness and colorThe best general default: even and clean
in oklchLightness, chroma and hue as a polar wheelVivid sweeps that keep their saturation
in oklch longer hueThe long way round the hue wheelRainbows and color wheels from two stops

Banding, the visible steps in a long and subtle gradient, is a different problem: an 8-bit display only has 256 levels per channel, so a dark navy fade across a wide hero runs out of in-between colors. Perceptual spaces spread those steps more evenly, adding a midpoint stop helps, and a faint noise texture layered on top hides what remains. Browsers that do not support the in clause drop the whole declaration, so turn on Fallbacks and the generator writes an sRGB version sampled from the same colors first.

How do I layer gradients for mesh-style backgrounds?

background-image accepts a comma-separated list, and the first image paints on top. Layering several soft radial-gradient() blobs that fade to transparent over a solid base gives the "mesh gradient" look with no image file at all. The rule that makes it work: every layer except the bottom one needs transparent regions, or it hides everything beneath it.

Use the Layers list to add, reorder, hide and duplicate layers, and drag each radial layer's center on the preview. The Aurora and Pastel mesh presets are good starting points.

Are CSS gradients good for performance?

Yes. A gradient is generated by the browser, so it costs no network request, stays sharp at any size and on any pixel density, and usually weighs a few dozen bytes of CSS instead of kilobytes of PNG. Painting even many layers is fast.

The cost appears when you animate them. Changing a gradient's colors or angle every frame repaints the whole element. Prefer animating transform or opacity on a pseudo-element that holds the gradient, or animate background-position on an oversized gradient. To animate an angle smoothly, register it as a typed custom property:

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.spin {
  background: conic-gradient(from var(--angle), #3b82f6, #ec4899, #3b82f6);
  animation: spin 4s linear infinite;
}
@keyframes spin { to { --angle: 360deg; } }

Wrap decorative motion in @media (prefers-reduced-motion: no-preference), and avoid background-attachment: fixed on large gradients, which scrolls poorly on many phones. To pair a gradient with a matching shadow or glass panel, see the box-shadow generator and the glassmorphism generator.

Frequently asked questions

Give two neighboring stops the same position, for example #0ea5e9 50% and #f97316 50%. There is no space between them to blend, so the edge is sharp. For stripes, repeat that pattern in a repeating-linear-gradient, such as yellow from 0 to 10px and black from 10px to 20px.
Hex and rgb() colors blend in sRGB by default, which averages channel numbers instead of perceived color, so complementary colors such as blue and yellow meet in gray. Add in oklab or in oklch to the gradient (the Interpolation option in Playxoft's CSS Gradient Generator) and the midpoint stays colorful.
Both are perceptually uniform. OKLab blends in a straight line through the color space, which gives clean, even transitions. OKLCH blends lightness, chroma and hue separately, so it travels around the hue wheel and keeps colors saturated, and you can choose the shorter or longer way round.
Linear, radial and conic gradients work in every current browser. The color-space syntax (in oklab, in oklch) is supported in Chrome and Edge 111+, Safari 16.2+ and Firefox 127+; older browsers ignore the whole declaration. Turn on Fallbacks and the generator writes an sRGB approximation first so those browsers still show nearly the same gradient.
Not directly between two gradient values, but you can animate the pieces. Register the angle or a color as a typed custom property with @property and animate that, animate background-position on an oversized gradient, or fade a gradient layer in and out with opacity, which is the cheapest option.
Set the gradient as the background, then clip it to the glyphs: background-image with your gradient, background-clip: text (plus -webkit-background-clip: text, still needed by some browsers) and color: transparent. Keep a solid color fallback for contrast checks and for browsers that do not clip.
No. The editor and the code generation run entirely in your browser. The Share link stores the design in the part of the URL after the # sign, which browsers never send to a server.

Last updated by the Playxoft engineering team.

From the designers who built this tool

Want your site to look this polished?

Consistent color, crisp typography and fast pages are what make a site feel premium. We build accessible, high-converting websites with design systems that stay consistent everywhere. Send us your site and we will share honest recommendations, free.