March 26, 20264 min read

CSS Gradient Generator

Generate beautiful CSS linear, radial, and conic gradients with a visual editor. Copy production-ready CSS code with browser prefixes included.

css gradient design frontend calchub
Ad 336x280

CSS gradients are one of those features where a little knowledge goes a long way. Most developers know linear-gradient(to right, #red, #blue) but don't explore the more nuanced controls — angle precision, color stop positioning, interpolation modes, or the newer conic-gradient and radial-gradient shapes that can produce effects that look like they required a design tool.

The Three Gradient Types

Linear gradients transition colors along a straight line at any angle. Most common for button backgrounds, hero sections, and text effects. Radial gradients radiate from a center point (circle or ellipse). Good for spotlight effects, glows, and circular UI elements. Conic gradients rotate colors around a center point. Useful for pie charts, loading spinners, and color wheels — and increasingly popular for creative borders and background patterns.

Using the CalcHub Generator

The CalcHub CSS Gradient Generator provides a visual drag-and-drop editor:

  1. Select gradient type (linear / radial / conic)
  2. Add color stops — click to add, drag to reposition
  3. Set colors via hex picker, HSL sliders, or named colors
  4. Adjust angle (linear) or center point (radial/conic)
  5. Preview on white, dark, and realistic backgrounds
  6. Copy the CSS output with optional -webkit- prefix
The generator supports multiple color stops, hard stops (abrupt transitions at the same position), and transparent stops for fade-to-transparent effects.

CSS Gradient Syntax Reference

/ Linear: 45-degree angle, 3 stops /
background: linear-gradient(45deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);

/ Radial: circle from center /
background: radial-gradient(circle at 50% 50%, #e94560 0%, #0f3460 70%);

/ Conic: starts at top, full rotation /
background: conic-gradient(from 0deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #ff6b6b);

/ Fade to transparent /
background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);

Practical Examples

Hero section overlay — A dark gradient over an image to ensure text readability:
background: linear-gradient(135deg, rgba(15,15,40,0.95) 0%, rgba(15,15,40,0.6) 100%);
Subtle card background — Barely-there gradient for depth:
background: linear-gradient(160deg, #f8faff 0%, #f0f4ff 100%);
Gradient border using pseudo-element trick:
.card {
  position: relative;
  border-radius: 12px;
}
.card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  z-index: -1;
}
Animated gradient (CSS only):
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.animated {
  background: linear-gradient(270deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradient-shift 6s ease infinite;
}

Color Interpolation Modes

CSS now supports gradient interpolation in different color spaces, which affects how mid-tones look:

ModeAppearanceUse When
sRGB (default)Can have dull gray midpointsLegacy compatibility
OKLCHVibrant, perceptually uniform midpointsModern browsers
HSLHue travels around color wheelRainbow effects
A gradient from blue to orange in sRGB goes through a muddy brown middle. The same gradient in OKLCH stays vivid throughout. The generator lets you compare modes side by side.

Tips

  • Avoid pure black (#000) in gradients. Use a very dark saturated color like #0a0a1a instead. Pure black in gradients looks flat and heavy.
  • Color stop percentages give precise control. linear-gradient(to right, red 0%, red 40%, blue 60%, blue 100%) creates a hard divide, not a transition.
  • Gradient text is possible. Apply gradient to background, then use background-clip: text and color: transparent. The CalcHub generator has a text gradient preview mode.

Do CSS gradients work in all browsers?

Modern gradient syntax (no prefixes) works in all browsers that matter in 2026. The conic-gradient has been supported since Chrome 69, Firefox 83, and Safari 12.1. The newer color-interpolation parameter requires Chrome 111+ and Safari 16.2+.

Can I use more than 2 colors in a gradient?

Absolutely. Gradients support as many color stops as you want. Designers commonly use 3–5 stops for depth. Just be careful about readability if you're overlaying text — more stops create more variable contrast.

What's the difference between radial-gradient circle and ellipse?

circle produces a perfectly circular gradient that maintains circular shape regardless of element dimensions. ellipse (the default) stretches to fill the element's shape. For consistent circular glows, always specify circle.
Ad 728x90