Logo

CSS Gradient Generator

Build beautiful linear, radial, and conic gradients with live preview. Powered by chroma.js for perfectly smooth color scales.

90°

Color Stops

#3b82f60%
#8b5cf6100%

Smooth Scale Generator

Use chroma.js color math to automatically generate a perfectly smooth gradient between your first and last color stops.

CSS Output

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

Free CSS Gradient Generator

Gradients are an essential part of modern web design, adding depth, branding, and visual interest to buttons, backgrounds, and text. Writing complex gradient syntax by hand can be tedious and error-prone. The OmniWebKit CSS Gradient Generator provides a visual, real-time playground to build the perfect gradient and instantly copy the production-ready CSS code.

Our generator supports full customization of Linear, Radial, and Conic gradients. You have complete control over the angle, focal points, and unlimited color stops. Best of all, everything runs instantly in your browser without requiring a server upload.

Powered by Chroma.js

One of the hardest parts of creating a beautiful gradient is avoiding "dead zones"—muddy, greyish transitions that happen when the browser interpolates between two clashing colors using standard RGB math.

To solve this, we've integrated the Smooth Scale Generator powered by chroma-js. By selecting a start and end color, our engine can automatically calculate and insert perfectly spaced color stops using advanced perceptual color spaces like LCH (Lightness, Chroma, Hue). This ensures incredibly smooth, vibrant transitions that standard CSS simply cannot achieve on its own.

Related Tools You Might Like

How linear gradient css syntax is put together

A gradient takes a direction and a list of colour stops. Everything else is detail.

The direction comes first, as an angle or a keyword like `to right`. Then each colour, optionally with a position. Omit positions and the browser spaces the stops evenly.

The angle convention is the part that trips everyone. CSS measures clockwise from pointing up, so 0deg runs upward and 90deg runs rightward. If your gradient looks rotated a quarter turn from what you intended, that is why.

Avoiding the grey dead zone in a multi stop gradient

Blend two colours from opposite sides of the colour wheel and the middle turns muddy. This is the most common complaint about CSS gradients.

The cause is the interpolation path. By default the browser moves in a straight line through the sRGB cube, and the straight line between two opposite hues passes close to the centre, where saturation is lowest.

Two fixes. Add an intermediate stop in the hue you want the transition to pass through, which gives you explicit control. Or interpolate in a perceptual colour space such as Oklch, where the path stays saturated — with the caveat that support is newer, so check your browser targets.

Why a gradient background css fade shows visible stripes

Banding is a precision problem rather than a rendering bug.

Standard displays handle 256 levels per channel. A gradient fading between two similar colours across a wide area may only have a handful of distinct values to work with, so each one covers many pixels and reads as a stripe.

Counter-intuitively, the fix is to add noise. A faint semi-transparent noise texture over the gradient breaks the boundaries up, and the eye reads the result as smooth. Making the gradient steeper or narrower also helps, by spreading fewer pixels over each colour step.

Keeping text readable over a colour transition

Contrast is a single number against a flat colour and a range against a gradient, which is where accessibility checks quietly fail.

Text crossing a gradient has a different contrast ratio at every point. Checking against the average, or against the colour under the first letter, passes a test the finished page fails.

Test against the worst point the text actually crosses. Where that cannot pass, the practical answers are a semi-transparent overlay behind the text, a solid panel, or confining the gradient to an area with no text over it.

How to use the CSS Gradient Generator

  1. Pick a gradient type: linear for an axis, radial for a point, conic for a sweep.
  2. Add colour stops, and place one at the midpoint if the blend passes through grey.
  3. Set the angle, remembering CSS measures clockwise from upward.
  4. Check text contrast against the lightest and darkest parts, not the average.
  5. Copy the CSS and paste it into your stylesheet.

What this tool handles

All three gradient types

Linear, radial and conic, with the syntax differences handled for you.

Multiple colour stops

Add stops anywhere, including two at one position for a hard edge.

Copyable CSS

Standard property output, ready to paste with no vendor prefixes needed.

Runs in the browser

No request made at any point; it is string building.

Frequently asked questions

Why does my blue-to-yellow gradient go through grey?

▼
Because the browser interpolates straight through the sRGB colour cube, and the midpoint between two opposite hues lands near grey. Adding a stop at the midpoint in the hue you want fixes it, or use a colour space like Oklch where the interpolation path stays saturated.

What causes visible bands instead of a smooth fade?

▼
Not enough distinct colour values across the distance. A subtle gradient over a wide area may only have a few dozen steps available in 8-bit colour, so each step becomes a visible stripe. A faint noise overlay is the usual fix, and it works surprisingly well.

What is the difference between linear, radial and conic?

▼
Linear runs along a straight axis you set by angle. Radial spreads outward from a point, as ellipse or circle. Conic sweeps around a centre point like a pie chart, which makes it the right choice for colour wheels and progress rings.

How do I make a hard edge instead of a fade?

▼
Place two stops at the same position. Red at 50 per cent followed by blue at 50 per cent gives a crisp line with no transition. That technique is how people build stripes and checkerboards in pure CSS, with no image file at all.

Why does the angle not match what I expected?

▼
CSS measures gradient angles clockwise from pointing up, so 0deg goes bottom to top and 90deg goes left to right. Most people expect the mathematical convention, which is anticlockwise from the right. The result is that angles often feel rotated by 90 degrees.

Can I animate a gradient?

▼
Not the colour stops directly — they are not animatable properties, which catches people out. The usual workaround is a gradient much larger than its container with the background-position animated. For genuine stop animation you need a custom property registered with @property.

Does a gradient cost more to render than a flat colour?

▼
Slightly, and almost never enough to matter. The exception is a large gradient that repaints frequently, such as one animated on scroll, where it can cause visible jank on weaker devices. A static gradient on a page background is effectively free.

Is text readable over a gradient?

▼
Only if you check it against the worst part. Contrast varies across the gradient, and text that passes against the dark end can fail badly against the light end. Test at the lightest point the text crosses, not at the average.

Does this generator send anything to a server?

▼
No. It builds a CSS string in your browser and nothing is transmitted. The network panel in developer tools stays empty while you use it, because there is nothing to send.

Why do browsers render the same gradient slightly differently?

▼
Dithering and colour management differ between engines, and newer colour-space interpolation is not uniformly supported. Differences are usually invisible. They become noticeable in very subtle gradients, where one browser dithers and another bands.
Advertisement