Design

CSS Gradient Generator

Build CSS linear, radial and conic gradients visually, and avoid the grey dead zone that ruins most of them.

Last reviewed by the Radiatus Cloud team

background: linear-gradient(to right, #3b82f6, #8b5cf6);

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

The grey dead zone

A gradient between two saturated colours interpolates through the sRGB colour space by default, and the midpoint frequently lands as a desaturated grey or brown. Blue to yellow is the classic offender. The fix is either adding a midpoint colour stop that keeps saturation up, or interpolating in a perceptually uniform space using the in oklab syntax, which modern browsers support and which avoids the problem entirely.

Three kinds of gradient

Linear runs along an axis you specify in degrees or keywords. Radial expands from a point, with circle or ellipse shape and a size keyword controlling where it ends. Conic sweeps around a centre, which is what makes pie charts, colour wheels and the sharp-edged pattern effects possible in pure CSS.

Colour stops do more than you think

Placing two stops at the same position creates a hard edge rather than a blend, which is how gradients are used to draw stripes and geometric patterns without images. Repeating gradients extend that further. Most non-obvious CSS background effects are hard-stop gradients rather than anything exotic.

Gradients cannot be transitioned

CSS cannot animate between two background-image gradients, because they are images rather than interpolatable values. The standard workaround is a gradient larger than the element with an animated background-position, or two stacked layers with opacity crossfading between them. Attempting a direct transition simply snaps.

Text over a gradient needs care

Contrast varies across the gradient, so text that is legible at one end can fail at the other. Check the ratio at both extremes, not at the average. Where the text must sit over a wide range, a semi-transparent overlay or a text shadow is more reliable than hoping.

Banding on subtle gradients

A gradient across a large area between two similar colours produces visible bands, because 8-bit colour has too few steps to render the transition smoothly. Adding a very subtle noise overlay breaks the bands up and is what most polished implementations do.

Related tools

  • Color Converter — Convert colours between HEX, RGB, HSL, HWB and OKLCH, with alpha support. Runs in your browser and shows the live swatch for each format.
  • Accessibility Color Contrast Checker — Check foreground and background colour contrast against WCAG thresholds, with the rules for text size, UI components and states.
  • Typography Scale Generator — Generate a modular type scale from a base size and ratio, with fluid clamp() values for responsive layouts.
  • Design Token Generator — Generate design tokens as CSS variables, JSON or platform formats, structured in the layers that make them maintainable.

Frequently Asked Questions

Why does my gradient go grey in the middle?

Because sRGB interpolation passes through a desaturated midpoint, worst between complementary colours like blue and yellow. Add a saturated midpoint stop, or interpolate in oklab, which avoids it entirely.

How do I create a hard edge in a gradient?

Place two colour stops at the same position. That produces a sharp line rather than a blend, which is how stripes and geometric patterns are drawn in pure CSS without images.

Can I animate between two gradients?

Not directly, because gradients are images rather than interpolatable values, so a transition snaps. Animate background-position on an oversized gradient, or crossfade two stacked layers with opacity.

What is a conic gradient for?

Sweeping colour around a centre point, which is what makes pie charts, colour wheels and radial patterns possible in CSS alone.

Why does my large gradient show bands?

Because 8-bit colour has too few steps to render a subtle transition across a wide area smoothly. A very subtle noise overlay breaks up the banding, which is what polished implementations do.

Privacy & Security

Runs locally in browser.

Data: None
Client-side-Side
Active
v1.0

About This Tool

This tool runs entirely in your browser. No data is sent to any server, ensuring complete privacy. Simply use the interface above to get started — no registration or login required.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.