How to make a mesh gradient in CSS
CSS has no mesh gradient function, but layered radial gradients get close. Here is how it works, where it breaks down and when to use an image instead.
Updated 2026-11-16
What a mesh gradient actually is
A mesh gradient blends several colours placed at points across a surface, so the colour changes in two directions at once. Design tools build it from a grid or from free-floating colour points; the result is the soft, liquid look you see on many product sites.
CSS only has one-directional building blocks: linear, radial and conic gradients. There is no function that takes a cloud of colour points. That is why every "CSS mesh gradient" is an approximation built from layers.
The layered radial-gradient technique
Place one radial gradient per colour point, each fading from the colour to transparent, and stack them over a base colour. Browsers composite the layers top to bottom, and where the soft edges overlap the colours mix.
.hero {
background:
radial-gradient(at 18% 22%, #7c3aed 0%, transparent 55%),
radial-gradient(at 82% 18%, #ec4899 0%, transparent 50%),
radial-gradient(at 25% 85%, #0ea5e9 0%, transparent 55%),
radial-gradient(at 78% 80%, #f59e0b 0%, transparent 50%),
#1e1b4b;
}Where the approximation shows
Stacked radial gradients blend by covering each other, not by interpolating between points, so you get visible "blobs" where a true mesh would flow smoothly. Mixing also happens in sRGB, which can turn the space between complementary colours grey.
CHROMA79 renders a real mesh (inverse-distance blending in the perceptual OKLab colour space, with an optional organic warp) and is explicit about the difference: its CSS export labels a mesh as an approximation and tells you which layers are affected.
When to use an image instead
If the exact look matters, export the mesh as an image and use it as the background. A WebP at the size of your hero section is usually tens of kilobytes for smooth gradients, and it looks identical on every browser.
.hero {
background: #1e1b4b url('mesh.webp') center / cover no-repeat;
}