UseToolSuite UseToolSuite

CSS Gradient Generator

Create linear and radial CSS gradients visually with a live preview. Adjust colors, angle, and stops — copy the ready-to-use CSS gradient code instantly.

90deg
Position 0%
Position 100%

Linear vs radial: pick by how the color travels

The two everyday gradient types differ in the shape of the transition:

  • Linear — colors travel along a straight line at a given angle. linear-gradient(180deg, ...) goes top to bottom. The workhorse for backgrounds, buttons, and overlays.
  • Radial — colors radiate outward from a center point in a circle or ellipse. Ideal for spotlights, glows, and adding depth.

Each is built from color stops — a color plus an optional position. Two stops give a simple fade; many stops give rich multi-color transitions; two stops at one position give a hard edge (see above).

The angle gotcha

CSS gradient angles don’t match design tools. In CSS, 0deg points up and 90deg points right, rotating clockwise. Figma and Photoshop start 0deg at the 3 o’clock position. So the same number renders in a different direction — to port a Figma angle to CSS, use CSS = 90° − Figma. The live preview is the fastest way to just dial in the direction you want without doing the arithmetic.

Interpolate in OKLCH for vivid results

By default CSS blends gradients in sRGB, which isn’t perceptually uniform — a red-to-blue fade sags through a grayish purple. CSS Color 4 lets you choose the interpolation space:

linear-gradient(in oklch, red, blue)

Interpolating in oklch (or in hsl) keeps the transition bright and even, passing through a vivid violet instead of mud. Supported in current Chrome, Safari, and Firefox — define your stops here, then add the color-space hint for noticeably richer gradients.

Taming color banding

On large gradients across similar tones (especially dark ones), 8-bit color depth produces visible stepped bands. Three fixes: add more intermediate color stops to smooth the ramp, overlay a faint (~2–4%) noise texture to dither the transition, or keep large flat gradients to higher-contrast color pairs where banding is less perceptible. A subtle grain overlay is the most reliable cure for hero-sized backgrounds.

Last updated Built and maintained by Necmeddin Cunedioglu How tools are tested

How helpful was this tool?

Click to rate

Key Concepts

Linear Gradient

A CSS gradient that transitions between colors along a straight line defined by an angle (e.g., 180deg = top to bottom). Color stops define where each color appears along the gradient line. Linear gradients are the most commonly used gradient type for backgrounds, buttons, and decorative UI elements.

Radial Gradient

A CSS gradient that radiates outward from a center point in an elliptical or circular shape. The innermost color appears at the center and transitions to outer colors. Commonly used for spotlight effects, button highlights, and creating depth in UI elements.

Color Stop

A point along a gradient line where a specific color is defined, optionally with a position (percentage or length). Multiple color stops create multi-color transitions. Placing two stops at the same position creates a hard color boundary instead of a smooth transition — useful for striped patterns.

Frequently Asked Questions

Can I add more than two color stops to the gradient?

The tool supports creating gradients with multiple color stops. You can add additional stops to create complex, multi-color gradients. Each stop can have its position adjusted along the gradient line.

Does the generated CSS work in all browsers?

Yes. The generated gradient CSS uses standard syntax that is supported by all modern browsers including Chrome, Firefox, Safari, and Edge. No vendor prefixes are needed for current browser versions.

Can I create conic or repeating gradients?

The tool focuses on linear and radial gradients, which are the most commonly used gradient types. Conic gradients and repeating gradients require manual CSS authoring, though the color values from this tool can serve as a starting point.

How do I make a gradient with crisp stripes instead of a smooth blend?

Place two color stops at the same position (or adjacent positions) so the transition has nowhere to fade. linear-gradient(90deg, red 50%, blue 50%) produces a hard edge at the halfway point — red on the left, blue on the right, no blend. Repeat the pattern for stripes: linear-gradient(45deg, #000 25%, #fff 25%, #fff 50%, #000 50%) tiled with background-size creates a checker/barber-pole effect. The rule is simple: a gradient blends between stops, so removing the gap between two stops removes the blend. This is how you build stripes, color bands, and progress-bar fills with pure CSS.

Why does my fade-to-transparent gradient look gray or muddy in the middle?

Because the keyword 'transparent' means transparent BLACK (rgba(0,0,0,0)), not 'invisible version of my color.' When you write linear-gradient(red, transparent), the browser interpolates from opaque red toward transparent black, so the midpoint is a dull, darkened, semi-transparent gray-red. The fix is to fade to a transparent version of the SAME color: linear-gradient(red, rgba(255,0,0,0)) — now the hue stays red all the way out as only the alpha drops. This is the single most common gradient bug, and it's why mesh-gradient and overlay effects often look dirty until you match the transparent stop's color to the opaque one.

Troubleshooting & Technical Tips

Color banding: Visible stepped color bands in gradient transitions

In large areas with gradient transitions between two similar tones, the browser may produce stepped bands (banding) due to 8-bit color depth — especially noticeable in dark tones. Solution: add a subtle CSS noise overlay to the gradient (filter: url(#noise) or an external SVG filter), add more color stops to smooth the transition, or use a small grain texture for a dithering effect. Use this tool to experiment with different color stops to visually minimize banding.

Gradient angle looks different than expected: CSS vs design tool difference

In CSS linear-gradient, 0deg points upward (bottom-to-top) and 90deg points right. However, design tools like Photoshop and Figma start 0deg from the 3 o'clock position (right) and rotate clockwise. The same angle value renders in different directions. To convert a design tool angle to CSS: CSS angle = 90° - Figma angle. Use this tool's live preview to adjust the angle and verify the direction you expect.

Non-perceptually uniform color transitions: sRGB interpolation limitation

CSS gradients are interpolated in the sRGB color space by default. sRGB is not perceptually uniform — a red-to-blue transition passes through a grayish midtone, while the same transition in OKLab color space produces a vibrant purple. With CSS Color Level 4, you can specify color interpolation: linear-gradient(in oklch, red, blue). Modern browsers (Chrome 111+, Safari 16.2+) support this syntax. Use this tool to define base colors, then specify the color space in CSS for more vibrant gradients.

Related Guides

Related Tools

Embed this tool on your site

Paste this snippet into any HTML page or blog post to embed a live, fully working copy of CSS Gradient Generator. Free for any use.