🎨 CSS Gradient Generator

Create vibrant CSS linear and radial gradients with custom color stops, angles, designer presets, and 1-click CSS code export. 100% free.

Free No Signup Required Browser-Based
%
%

CSS

background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);

What CSS Gradient Generator Does

A CSS gradient is a generated image, not a color, and almost everything that goes wrong with one follows from that. It has a direction, a set of color stops with positions, and — the part that changed in the last few years and that most generators have not caught up with — a color space in which the interpolation between those stops happens.

The single most common bug in hand-written gradients is fading to transparent. The CSS keyword `transparent` is defined as `rgba(0, 0, 0, 0)`: transparent BLACK. Fade a blue to it in sRGB and the midpoint passes through a muddy dark gray, because you are interpolating toward black while the alpha drops. The fix is to fade to the same color at zero alpha instead, and the generator writes it that way.

The second is interpolation space. sRGB interpolation runs through a desaturated middle on many color pairs — the classic blue-to-yellow gradient that turns gray in the center. Interpolating `in oklab` keeps the midpoint vivid because the space is perceptually uniform; `in oklch` travels around the hue wheel instead, which gives you rainbow-like transitions rather than a straight line through color space.

Beyond that this covers what the search actually asks for: linear, radial and conic, up to five stops with positions you control, and a text-gradient output, since applying a gradient to type is one of the most searched variants and needs `background-clip` rather than `color`.

How to Use CSS Gradient Generator

  1. Select Linear or Radial gradient mode
  2. Pick starting and ending colors using the interactive color pickers
  3. Adjust the gradient angle slider (0° to 360°)
  4. Copy the ready-to-use CSS background rule for your website

Why the `transparent` keyword ruins a fade

Both gradients start from the same blue. Only the second stays blue.

Written asWhat the midpoint becomesResult
#3b82f6 → transparentrgba(30, 65, 123, 0.5)Fades through dark gray — the classic muddy edge
#3b82f6 → rgba(59, 130, 246, 0)rgba(59, 130, 246, 0.5)Stays the same hue while the alpha drops

Choosing an interpolation space

SyntaxBehaviorUse when
(default, sRGB)Straight line through sRGB; can desaturate in the middleMaximum browser support, or the colors are close together
in oklabPerceptually uniform; keeps the midpoint vividTwo distant colors where sRGB goes gray
in oklchTravels around the hue wheelDeliberately rainbow-like transitions

How to Read Your Result

Ship a fallback before the modern syntax

A browser that does not understand `in oklab` discards the whole declaration, leaving no gradient at all rather than a worse one. Write a plain sRGB gradient first and let the modern one override it on the next line — the cascade handles the rest.

Gradients on text need background-clip

You cannot put a gradient in `color`. The pattern is to set the gradient as the background, clip it to the text with `background-clip: text`, and make the text itself transparent so the background shows through. Keep the `-webkit-` prefixed property alongside it; it is still required in practice.

Stop positions matter more than stop count

A gradient with two stops at 0% and 100% spends most of its length in the transition. Moving the stops inward — 20% and 80% — gives you solid color at each end and a faster change between, which usually reads as more deliberate than a slow wash.

Limitations & Accuracy Notes

  • Linear, radial and conic only. Repeating gradients, multiple layered gradients and gradient borders are not generated here.
  • The `in oklab` and `in oklch` syntax needs a recent browser; the page says so and the fallback advice above applies.
  • Radial gradients are emitted as a centered circle. Ellipses, explicit sizing keywords and off-center positions are not exposed.
  • The preview shows the gradient over a checkerboard so transparency is visible honestly, but your own background will differ.
  • No color-blindness simulation, and gradients that rely on hue alone to convey meaning can be unreadable for some viewers.

Frequently Asked Questions

What is the difference between Linear and Radial gradients?
Linear gradients transition colors smoothly along a straight directional angle (e.g. 90deg), while Radial gradients radiate outwards from a central point.
Are CSS gradients performant in modern browsers?
Yes, CSS gradients are hardware-accelerated by the GPU and are infinitely more lightweight than loading large background image files.
What is the difference between linear, radial and conic gradients?
Linear runs along a straight axis, radial spreads outward from a point, and conic sweeps around one like a pie chart — which is why conic is what you use for pie charts and color wheels in pure CSS.
Why does my gradient look muddy in the middle?
Because interpolating between complementary colors in sRGB passes through gray. Adding an intermediate stop in a more saturated hue avoids it, and newer CSS color interpolation options can blend through a different color space entirely.
What causes visible banding?
Limited color depth across a wide, subtle gradient — the steps become visible as stripes. Adding a very slight noise overlay is the standard fix, and shorter or higher-contrast gradients band less.
How do I create a hard edge rather than a blend?
Place two color stops at the same position. The color changes instantly at that point, which is how stripes and multi-color flags are built with a single gradient.
Is a gradient an image in CSS?
Yes — gradients are generated images, so they go in background-image rather than background-color, and they can be layered with other backgrounds and sized with background-size.
Is my CSS sent anywhere?
No. The gradient is composed in your browser and the code is generated locally.

References & Further Reading

By OnlineToolHubs Team • September 2026