Skip to content
T
Tools.Town
Free Online Tools for Everyone
Design Tools

How to Use CSS Gradient Generator — Complete Guide

Learn how to build linear and radial CSS gradients visually using the free CSS Gradient Generator on Tools.Town — live preview, 6 color stops, preset library, no sign-up.

7 May 2026 4 min read By Tools.Town Team Fact Checked

Key Takeaways

  • linear-gradient() sweeps colors along a straight line from one angle to another
  • The CSS Gradient Generator supports up to 6 stops
  • Banding happens when two very similar colors are used across a large gradient area
  • Yes

What is CSS Gradient Generator?

CSS Gradient Generator is a free visual tool that lets you build linear-gradient() and radial-gradient() CSS rules without writing a single line of code. Adjust colors, positions, angles, and shapes in real time — then copy the finished CSS rule directly into your project.

CSS gradients are pure CSS — no images, no external files. They render crisply at any screen resolution and size, load instantly, and can be animated with CSS transitions.


The Two Gradient Types

Linear

Colors sweep along a straight line. Controlled by angle (0–360°) or a named direction: to right, to bottom-right, etc.

Radial

Colors radiate outward from a focal point. You control shape (circle or ellipse) and the focal position within the element.


How to Use the CSS Gradient Generator

01

Choose a type

Select Linear or Radial. Linear is the default — good for backgrounds, buttons, and banners.

02

Add color stops

Click 'Add stop' to add up to 6 stops. Click any stop to change its color using the color picker.

03

Set positions

Drag each stop along the gradient bar to set where it sits (0% = start, 100% = end).

04

Adjust angle

For linear, drag the angle dial or type a value (90° = left to right, 180° = top to bottom).

05

Copy and paste

Hit Copy CSS — the full background property is in your clipboard, ready for your stylesheet.


Understanding the CSS Output

The tool generates standard CSS. Here are the two forms:

Linear gradient:

background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);

Radial gradient:

background: radial-gradient(circle at center, #6366f1 0%, #1e1b4b 100%);

The values break down as:

  • 135deg — angle for linear (or circle at center for radial)
  • #6366f1 0% — color stop: hex color followed by its position along the gradient

You can paste this directly as a background or background-image property on any element.


The Preset Library

Not sure where to start? The preset library gives you a set of curated gradients to use as-is or customize:

PresetColorsGood for
SunsetOrange → Pink → VioletHero backgrounds, cards
OceanTeal → Blue → NavyDashboard headers, charts
AuroraGreen → Teal → BlueDark mode UIs, banners
BrandViolet → PurpleButtons, CTAs, accents

Click any preset to load it into the editor, then tweak from there.


Common Gradient Patterns

Full-page hero background:

body {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  min-height: 100vh;
}

Button with hover shift:

.btn {
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
  transition: background 0.3s ease;
}
.btn:hover {
  background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
}

Spotlight / vignette effect:

.card::after {
  content: '';
  background: radial-gradient(ellipse at top, rgba(99,102,241,0.3) 0%, transparent 70%);
}

Tips & Common Mistakes

Start with 2 stops, add more if needed. Two well-chosen colors almost always look cleaner than four mediocre ones. Only add a third stop when you need to control the midpoint color explicitly.

Avoid near-identical hues across large areas. If your two colors are close on the color wheel, the middle of the gradient can look grey and muddy. Use the contrast checker to verify your colors have enough visual distance.

Use to right instead of 90deg in production. Named directions are easier to read in code review and less likely to break when you copy-paste. Both produce the exact same result:

Direction: named vs numeric

✓ Preferred
background: linear-gradient(to right, #6366f1, #8b5cf6);

Readable — intent is obvious at a glance

≈ Also works
background: linear-gradient(90deg, #6366f1, #8b5cf6);

Numeric — same visual result, less readable

For dark UI gradients, go dark-to-darker, not dark-to-black. Pure black at one end kills vibrancy. Use deep navy or violet instead:

Dark gradient: navy vs black endpoint

✓ Preferred
background: linear-gradient(135deg, #4f46e5, #1e1b4b);

Deep violet endpoint — rich, not flat

✗ Avoid
background: linear-gradient(135deg, #4f46e5, #000000);

Pure black endpoint — vibrancy killed

Pair radial gradients with dark backgrounds. A subtle glow effect is hard to replicate any other way:

Radial glow on dark background

✓ Glow effect
background: #0f172a;
background-image: radial-gradient(circle at 40% 40%, rgba(99,102,241,0.25) 0%, transparent 65%);

Depth without any images or shadows

✗ Without glow
background: #0f172a;

Flat — no visual depth


Advertisement

Try CSS Gradient Generator — Free

Apply what you just learned with our free tool. No sign-up required.

Try CSS Gradient Generator

Frequently Asked Questions

What is the difference between linear-gradient and radial-gradient?
linear-gradient() sweeps colors along a straight line from one angle to another. radial-gradient() radiates colors outward from a central point, producing circular or elliptical patterns.
How many color stops can I use?
The CSS Gradient Generator supports up to 6 stops. Technically, CSS itself supports unlimited stops, but 2–4 produce the cleanest results. More stops can cause muddiness unless carefully chosen.
Why does my gradient look banded or patchy?
Banding happens when two very similar colors are used across a large gradient area. Add an intermediate stop at the same hue with slightly different lightness, or add a small amount of noise to the background in CSS to mask it.
Does the generated CSS work in all browsers?
Yes. The output uses standard CSS syntax (linear-gradient and radial-gradient) supported by all modern browsers since IE10. No vendor prefixes are needed.
Can I create a conic gradient with this tool?
The current tool covers linear and radial. Conic gradients (conic-gradient()) are on the roadmap.

Was this guide helpful?

Your feedback helps us improve our content.

Continue Reading

All Design Tools Guides

Get the best Design Tools tips & guides in your inbox

Join 25,000+ users who get our weekly design tools insights.