CSS Gradient Generator
Build linear, radial, and conic CSS gradients with unlimited stops, angle control, and color-space interpolation. Live preview and one-click ready-to-paste CSS output.
- Linear, radial, and conic gradients in one canvas
- Unlimited stops with drag-to-reorder and precise position input
- Interpolate in sRGB, OKLCH, OKLab, or HSL — no more muddy midpoints
- Hard stops, ease hints, and conic angle control
Direct answer
CSS Gradient Generator
CSS
background-image: linear-gradient(135deg, #6366F1 0%, #EC4899 100%);When this saves you time
Real workflows where css gradient generator replaces tedious manual work or an in-app subscription tool.
Hero section gradient with brand colors
Subtle CTA highlight
Mesh-style multi-radial backgrounds
Conic gradient as a donut chart
Spinning gradient ring
Glassmorphism-style soft glow
How it works
The methodology — every transformation documented so the output is reproducible.
Pick a gradient type
Linear flows along an angle. Radial flows outward from a center. Conic sweeps around an angle. Pick the right primitive — converting between them after the fact is rarely clean.
Place color stops
Each stop has a color and a position (0–100%). Add as many as you want. Two stops at the same position create a hard stop — useful for stripes, pies, and progress fills.
Choose an interpolation space
CSS Color Level 4 lets you specify how colors blend between stops: 'in oklch' avoids gray midpoints, 'in hsl longer hue' goes the long way around the wheel for rainbow effects.
Copy production CSS
The output is a single CSS declaration ready to paste. The generator also emits Tailwind v3 background-image utilities and a backward-compatible sRGB fallback for browsers without Color Level 4 support.
Worked examples
| Input | Result | Notes |
|---|---|---|
| Linear · 135deg · sky blue → indigo | linear-gradient(135deg in oklch, #0EA5E9, #6366F1) | Common SaaS hero. OKLCH keeps the midpoint vibrant instead of muddy. |
| Radial · circle at center · spotlight | radial-gradient(circle at 50% 50%, rgba(255,255,255,0.3), transparent 70%) | Soft white halo for glassmorphism. Transparent at 70% means smooth fade-out. |
| Conic · 25% progress · accent | conic-gradient(#2563EB 0 25%, #E5E7EB 25% 100%) | Hard stops at 25% — instant donut/progress ring with one CSS rule. |
| Linear · 90deg · 3-color sunset | linear-gradient(90deg in oklch, #FB923C 0%, #EF4444 50%, #7C3AED 100%) | Three stops, equally spaced, blending in perceptual space. |
| Conic · rainbow color wheel | conic-gradient(in hsl longer hue, red, red) | Two identical stops with 'longer hue' interpolation traverses the whole hue wheel. |
Common mistakes to avoid
Letting sRGB interpolation produce gray midpoints
Using too many stops
Forgetting browser fallback
Putting text directly on a gradient
Frequently Asked Questions
The interpolation space revolution
CSS Color Module Level 4 added a quiet but huge feature: interpolation space selection. Until 2023, every gradient blended in sRGB — fine for similar hues, ugly for opposite ones. The 'in oklch' or 'in oklab' qualifier tells the browser to do the blend math in a perceptually uniform color space, where the “straight line” between two colors stays in the vibrant region of the gamut instead of dipping through gray.
The practical impact is dramatic. A gradient from #0EA5E9 (cyan) to #F97316 (orange) in sRGB has a dead muddy region near 50%. The same gradient in OKLCH stays bright magenta-pink through the middle. Browsers fall back to sRGB if the interpolation keyword is unsupported, so it's safe to opt in unconditionally.
When to reach for each gradient type
Linear is the default — use it for hero backgrounds, button highlights, dividers, and any directional flow. Radial shines for spotlights, glows, and vignettes; layer multiple radials at different positions to fake a mesh gradient. Conic is underused but powerful: pie/donut charts, color pickers, loading rings, and any visual element that wraps around a center point. A conic gradient with hard stops at percentage positions renders a complete pie chart in a single CSS line.
Performance and accessibility
Gradients are GPU-accelerated and effectively free. The concerns are accessibility: text contrast against a gradient must be computed at the worst-case point, and motion (e.g. animating a conic angle) needs to respect prefers-reduced-motion. The generator emits static CSS, so you can layer your own motion rules on top with appropriate media queries. For palette work that feeds gradients, the palette generator is the natural upstream tool.