Skip to main content

CSS Gradient Generator

Pick a gradient type, set the angle or center, and arrange your color stops — the preview updates as you work, and the code underneath is the exact background declaration to paste into your stylesheet.

Private by construction: the gradient is assembled entirely in your browser. Nothing is uploaded, and the page keeps working with the network unplugged after it loads.

Gradient type
Stop 1
Stop 2

Your CSS

background: linear-gradient(135deg, #17c08a 0%, #0b7a5c 100%)

Private by construction: every value is turned into CSS in your browser — nothing is uploaded, sent, or logged.

Embed this calculator on your website →

The formula

background: linear-gradient(angle, color position, …)

  • angle — the direction the gradient runs, in degrees: 0 points up, 90 points right, 180 down. Angles wrap, so −45 and 315 print as 315.
  • color stops — each stop is a color plus where it sits, as a percentage along the gradient line. Leaving a position blank lets the browser space the stops evenly itself.
  • positions print as entered — stops are never sorted, clamped, or completed behind your back. Out-of-order positions are legal CSS (the browser applies its own fix-up when rendering); the tool shows you the code you asked for.
  • opacity — a stop below full opacity prints in the legacy rgba(r, g, b, a) spelling every browser accepts; a fully opaque stop prints as plain lowercase hex.

Worked example: the tool's starting state — a 135° linear gradient from #17c08a at 0% to #0b7a5c at 100% — prints linear-gradient(135deg, #17c08a 0%, #0b7a5c 100%).

How it works

Three shapes, one idea. A linear gradient blends along a straight line at your angle. A radial gradient blends outward from a center point — a circle stays round, an ellipse stretches with the box. A conic gradient sweeps colors around the center like a pie chart, starting at the angle you set.

What the browser does with your stops. Between two stops, the browser mixes the colors in proportion to distance. Before the first stop and after the last, the end colors hold solid — which is why a 20%-to-80% gradient has flat bands at both ends.

The preview is your own browser. The swatch is rendered by the same engine that will render your site, so what you see is what your visitors get — including how it treats any out-of-order stops you deliberately enter.

Examples

  • A soft radial glow — radial, circle, center 50%/50%, white at 0% to a deep green at 100%: radial-gradient(circle at 50% 50%, #ffffff 0%, #0b7a5c 100%)
  • A pie-chart sweep — conic from 45°, four stops at 0 / 25 / 50 / 100%: conic-gradient(from 45deg at 50% 50%, #ff0000 0%, #ffff00 25%, #00ff00 50%, #0000ff 100%)
  • A fading overlay — a stop at 33% opacity prints rgba(0, 0, 0, 0.33), so a black-to-transparent fade is two stops: black at 0.33 opacity, then any color at opacity 0.

Frequently asked questions

Why does my angle print differently from what I typed?

Angles wrap every 360 degrees: 450 is one full turn plus 90, so it prints as 90; −45 prints as 315. The gradient itself is identical — the tool prints the canonical angle so the code is predictable.

What happens if I leave a stop's position blank?

The stop prints as just its color, and the browser spaces the unpositioned stops evenly between their positioned neighbours — the standard CSS behaviour. It is the quickest way to an even blend.

Can I use the output in Tailwind or inline styles?

The value works anywhere a CSS background is accepted: a stylesheet rule as shown, an inline style attribute, or Tailwind's arbitrary-value syntax as bg-[linear-gradient(...)] — in that last case replace the spaces with underscores, as Tailwind requires.

Why rgba() instead of the newer rgb() space syntax?

Deliberate compatibility: the comma rgba() spelling is understood by every browser that supports gradients at all, including older ones still in the wild. The color itself is identical either way.