CSS gradient generator Shape the transition.

Choose color stops, compare interpolation and take the CSS into your project.

Edit your gradient

Two to six stops. The preview and code use the same settings.

Current gradient

Transparency is shown over the selected solid backdrop. The backdrop is exported separately.

Color stops

Stops are rendered in position order; equal positions make a hard edge. Colors may include alpha. Opacity sets the color’s alpha.

Stop 1

Stop 2

Stop 3

Compare interpolation spaces

These use the same colors, geometry and output notation. Only interpolation changes; OKLCH also uses the selected hue path.

sRGB

OKLab

OKLCH

Use the result

.gradient {
  background-color: rgb(255, 255, 255);
  background-image: linear-gradient(110deg, rgb(37, 99, 235) 0%, rgb(167, 139, 250) 50%, rgb(251, 113, 133) 100%);
  background-image: linear-gradient(110deg in oklab, #2563eb 0%, #a78bfa 50%, #fb7185 100%);
}

Use background-image, not background-color, for a gradient. The first declaration is a legacy sRGB approximation; supporting browsers use the second. Test in your target browsers.

The fallback may look different because it uses legacy sRGB interpolation.

Color calculations run in your browser. The website still loads assets, advertising and analytics.

One gradient, deliberate choices

Control the stops and inspect the transition before using it.

Place colors where you need them

A linear gradient follows an angle; a radial gradient expands from a center. Add, remove or reverse stops and adjust each position and alpha. Two stops at the same position produce a deliberate hard edge.

Conceptual 3D gradient editor with color stops and a color disc

Compare the middle, not just the endpoints

Different interpolation spaces can produce different intermediate colors. Compare sRGB, OKLab and OKLCH using identical stops. Color notation is a separate choice: changing HEX to OKLCH does not automatically choose OKLCH interpolation.

Three artistic gradient panels illustrating different color transitions

How to create a CSS gradient

Start with the geometry, then refine color and compatibility.

01

Choose the direction or center

Select linear and adjust the angle: 0° points up and 90° points right. For radial, choose circle or ellipse and move its center. The preview uses the same shape and position as the exported CSS.

02

Edit the stops and compare spaces

Use two to six colors with positions between 0% and 100%. Enter alpha in the color or set opacity. Compare the three spaces; the shorter/longer hue option applies only to OKLCH. The solid backdrop makes transparency visible.

03

Copy CSS and verify its context

Choose source, HEX, RGB or OKLCH notation, then copy or download the stylesheet. Keep both gradient declarations for fallback behavior. Check text at its actual position across the background; a solid-color contrast check cannot certify an entire gradient.

CSS gradient generator FAQ

Stops, transparency, interpolation and browser support.

What is the difference between linear and radial gradients?

Linear gradients transition along a straight direction. Radial gradients spread from a center as a circle or ellipse. In this tool the radial size is farthest-corner; move the center to change its placement.

Why does the middle of my gradient look dull?

Intermediate colors depend on the endpoint colors and interpolation space. Compare sRGB, OKLab and OKLCH with the same stops. OKLCH can follow a different hue path, but it is not automatically better for every combination.

Can I add transparent colors and more than two stops?

Yes. Use two to six stops and set each opacity or enter a color with alpha. The chosen solid backdrop shows through transparency. The opacity slider sets alpha rather than multiplying the existing alpha.

What happens when stops are out of order or share a position?

Rendering sorts stops by percentage while keeping the editor rows stable. Equal positions retain row order and create a hard edge. The first and last colors extend to the edges if their positions do not reach 0% and 100%.

Does OKLCH color notation mean OKLCH interpolation?

No. A color’s notation describes that stop; the interpolation selector controls how colors between stops are computed. The generated modern CSS explicitly includes in srgb, in oklab or in oklch, so that choice is unambiguous.

How does the CSS fallback work?

The stylesheet sets a solid background and two background-image declarations. The first uses mapped RGB stops and legacy gradient syntax. Browsers that accept the second use the selected interpolation. The fallback can differ visually and is not a pixel-perfect reproduction.

Is text over the gradient automatically accessible?

No. Contrast can vary with position, element size and transparency. Review the actual text location and worst background under it. Add an appropriate solid text surface when needed; a ratio for two isolated stops does not certify the gradient.

Can I export an image or share my settings?

This version exports CSS text and a .css file, not a raster image. The URL fragment keeps your current stops and settings for reloads and language changes. Share that full URL to reproduce the configuration; browsers and displays may render colors differently.

Technical references: MDN · linear-gradient · MDN · radial-gradient · CSS Color 4

Give your colors a direction.

Refine the transition, compare the spaces and copy the CSS.

Check the fallback and text readability in the final layout.