CSS Gradient Generator
| Preset | CSS | Where it shines |
|---|---|---|
| Sunset fade | linear-gradient(180deg, #ff7e5f, #feb47b) | hero banners, warm CTAs |
| Cool ocean | linear-gradient(90deg, #2e3192, #1bffff) | tech headers, dashboards |
| Card wash | linear-gradient(135deg, #f6f7f9, #e8ebf0) | subtle section backgrounds |
| Fade to black | linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.7)) | text legs on photos |
| Spotlight | radial-gradient(circle at 30% 30%, #ffffff, #dddddd 60%) | soft vignettes, spheres |
| Color wheel | conic-gradient(red, yellow, lime, cyan, blue, magenta, red) | pie rings, loaders |
Every gradient on the web is one line of CSS - this generator builds that line visually: pick two colors, dial an angle or switch to radial, watch the live preview, and copy the exact declaration. The preview uses the browser’s real rendering engine, so what you see is byte-for-byte what ships.
The presets are tuned starting points: sunset for hero sections, ocean for calls to action, midnight for dark-mode headers - each one a different angle, which is half of what makes a gradient feel right.
How to use
- Pick start and end colors, set the angle (0deg points up, 90deg points right), or switch to radial for a center-out blend.
- Copy CSS puts the finished background declaration on your clipboard, ready to paste into a stylesheet.
- The URL carries your colors and angle - share the link and a teammate opens the same gradient.
Worked examples
The sunset preset, decoded
linear-gradient(90deg, #ff7e5f, #feb47b) reads left to right: 90deg points the sweep to the right, the salmon #ff7e5f anchors the left edge, the peach #feb47b the right. Clicking the sunset chip writes exactly that string - and the copy button outputs background: linear-gradient(...); ready for a stylesheet. Every gradient you will ever ship is this line plus more stops.
The text-leg overlay
Photo captions need a dark fade under white text: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.7)) paints nothing at the top and 70 percent black at the bottom, so the image shows through while the caption gains contrast. It is the single most-copied gradient on production sites, and the preset table carries it as the fade-to-black row.
The banding check
Two colors close in lightness (say #f6f7f9 to #e8ebf0 across a full screen) can band - visible stripes where the 8-bit display runs out of steps between them. The fix is physics, not syntax: add distance (a shorter span), add a mid stop, or nudge the colors apart in lightness. The live preview shows banding before the users do.
Frequently asked questions
Why does my gradient look banded?
Banding appears when the two endpoint colors are close in lightness: 8-bit displays offer only 256 steps per channel, so a low-contrast blend shows visible rings. Adding a subtle intermediate stop, slight noise, or nudging the lightness apart all hide it.
What is the difference between 0deg and 90deg?
In CSS, angles point toward where the gradient is heading: 0deg goes bottom-to-top, 90deg left-to-right, 180deg top-to-bottom. Design tools often use compass-style angles, which is the classic source of a gradient coming out sideways.
When should I use radial instead of linear?
Radial radiates from a center point outward - natural for glows, spotlights and vignettes; linear sweeps in one direction - natural for skies, buttons and section backgrounds. Switching the type is often the fastest fix for a gradient that feels "wrong" without being broken.
Do I still need vendor prefixes?
No - unprefixed linear-gradient and radial-gradient have worked in every browser since 2013-ish. Pages that still emit -webkit-gradient (the ancient two-value syntax) are carrying dead code from the IE era.
What is a conic gradient, and when do I reach for it?
A conic gradient sweeps around a point like a clock hand instead of across a line: conic-gradient(red, yellow, lime, cyan, blue, magenta, red) paints a color wheel, and a hard stop (two colors at the same percentage) turns it into a pie chart or a loader ring. It is the third sibling after linear and radial - the preset table’s color-wheel row is the whole idea in one paste-ready line.