Guide
Designing CSS gradients that look smooth, not muddy
Gradients add depth to hero sections, buttons, cards and backgrounds without loading an image. CSS can draw them natively, but writing the syntax by hand and guessing at angles and stops is tedious. This generator lets you design a gradient visually and copy clean CSS, or download it as a PNG for slides, social posts and wallpapers.
Making a gradient
- Choose a type: Linear, Radial or Conic.
- Set the angle for linear and conic gradients.
- Adjust the color stops: each has a color and a position from 0 to 100%. Add color inserts a new stop; the minus button removes one (at least two remain).
- Or start from a preset and adjust it.
- Click Copy CSS to copy the
background:declaration, or set a width and height and download a PNG.
Your last gradient is remembered in this browser.
Choosing a type
| Type | What it does | Good for |
|---|---|---|
| Linear | Blends along a straight line at an angle | Hero sections, buttons, headers |
| Radial | Spreads in a circle from the center | Spotlights, soft glows, vignettes |
| Conic | Sweeps around the center like a clock hand | Color wheels, pie-like effects, loaders |
Angles in CSS: 0deg goes from bottom to top, 90deg left to right, 180deg top to bottom. 135deg, a popular choice, runs from the top-left to the bottom-right.
Smooth, vivid blends
Gradients between very different hues, such as blue to yellow or red to green, often get a muddy gray band in the middle. That happens because browsers blend in the sRGB color space by default.
Turn on Smoother colors (OKLCH) to add in oklch to the CSS. OKLCH is a perceptual color space, so the transition stays bright and even. Current browsers support it; older ones ignore the declaration, so add a plain fallback gradient on the line above.
Another fix is a middle stop: add a third color at 50% that you choose yourself.
Stops and hard edges
- Spacing stops unevenly controls where the transition happens: stops at 0% and 30% make a quick change near the start, then solid color.
- Two stops at the same position create a hard edge, useful for stripes, split backgrounds and progress bars.
- Subtle is usually better: two neighboring hues, or one hue at two lightness levels, look more professional than a rainbow.
Text over gradients
Text has to stay readable across the whole gradient. Check the text color against both ends with the Contrast Checker; the lighter end is usually the problem. A gradient that runs from dark to slightly less dark gives white text room everywhere.
Exporting a PNG
Set a width and height (16 to 8,000 pixels) and download the gradient as an image for presentations, social posts, video thumbnails or phone wallpapers. The PNG uses standard blending, so with OKLCH switched on it can differ slightly from the CSS version in the browser.
Using the CSS
The copied code looks like:
background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
Paste it into the rule for your element. To layer a gradient over a photo, list the gradient first: background: linear-gradient(...), url(photo.jpg);, with semi-transparent colors so the photo shows through.
Who designs gradients
- Web designers create hero sections, buttons and card backgrounds.
- Social media designers make backgrounds for quotes and announcements, downloaded as PNG.
- Presenters make slide backgrounds that match a brand.
- App developers add depth to onboarding screens.
A complete example: a hero background with readable text
- Choose Linear at 135°, with two neighboring brand colors, a dark blue and a slightly lighter blue.
- Turn on OKLCH for a smooth transition.
- Check white heading text against both ends in the Contrast Checker.
- Copy the CSS, and add a plain background color on the line before it as a fallback.
Tips
- Subtle gradients, two close colors, look more professional than rainbows.
- Download a PNG at your slide or post size for use outside websites.
Related tools
- Color Palette Generator to pick colors that work together.
- Box Shadow Generator for depth on cards and buttons.
- Color Converter to convert stop colors to other formats.
Checked against the current version of the Gradient Generator on .

