Instead of memorizing linear-gradient(...) syntax and typing it by hand every time you need a background gradient, build it visually here and copy the finished CSS.
Gradient types and syntax
- Linear (linear-gradient): A single angle sets the direction.
90deggoes left to right,180deggoes top to bottom. - Radial (radial-gradient): Spreads outward from a center point. You choose a shape (circle or ellipse) and a center position.
- Conic (conic-gradient): Colors sweep clockwise around a center point. You choose a starting angle and a center position.
All three use a list of color stops. Each stop is a color plus a position (0-100%), and this tool lets you add, remove, and reorder anywhere from 2 to 8 of them. You can also drag a handle on the gradient bar to move a stop, or click the bar to add one where you want it.
Why OKLCH interpolation avoids muddy midpoints
By default, a CSS gradient blends two colors’ red, green, and blue values in a straight line through the sRGB color space. The catch is that perceived brightness doesn’t scale evenly with those numbers. So blending two colors that sit far apart on the color wheel makes the midpoint dip in brightness, reading as muddy or nearly gray.
- Red (#ff0000) to green (#00ff00): the sRGB midpoint is a dull olive (#808000), while the OKLCH midpoint is closer to a bright orange.
- Blue (#0000ff) to yellow (#ffff00): the sRGB midpoint is nearly gray (#808080), while the OKLCH midpoint is closer to a vivid teal.
OKLCH separates lightness (L), chroma (C), and hue (H) into their own axes, so it’s much easier to shift hue while keeping lightness steady — and the midpoint stays vivid as a result. Turn on this tool’s “Interpolate in OKLCH” option to see that exact calculation applied, in both the preview and the copied CSS.
Browser support and the fallback
Color-interpolation-method syntax like in oklch is a relatively recent addition to the CSS spec, so older browsers may not recognize it. When you turn on OKLCH interpolation, this tool writes two lines when you copy the CSS:
- A fallback line that looks the same everywhere, with the OKLCH-computed colors expanded into many plain sRGB stops
- A line using the real
in oklchsyntax
Declaring the same property (background) twice means CSS applies whichever one comes later, so a browser that understands in oklch uses the second line, and one that doesn’t falls back to the first automatically. Actual support keeps evolving, so for anything that matters, check against your own target browser list directly.