CSS Gradient Generator

CSS Gradient Generator

Pick gradient type → Add color stops → Copy CSS. Live preview, free.

Linear / Radial / ConicFreeLive Preview1-Click Copy
Preview
Gradient Type
Angle
135°
360°
Color Stops (3)
%
%
%
CSS Code
background: linear-gradient(135deg, #db2777 0%, #7c3aed 50%, #2563eb 100%);
Preset Gallery
1-click to apply
3 Gradient Types
When to use each
Linear
Best for hero sections, buttons, and cards. Flows in one direction.
Radial
Perfect for spotlight effects and circular UI elements.
Conic
Great for pie charts, color wheels, and artistic effects.
Quick CSS Tips
Advanced gradient tricks
Gradient text
background-clip: text;
color: transparent;
Gradient border
border-image: linear-gradient(...) 1;
Stack gradients
background:
  linear-gradient(...),
  radial-gradient(...);

What Are CSS Gradients?

CSS gradients let you create smooth transitions between two or more colors without using images. The browser calculates and renders the gradient in real time, making pages load faster than image backgrounds while staying perfectly sharp at every screen size and resolution.

CSS supports three main gradient types: linear-gradient (color transitions along a straight line), radial-gradient (radiating from a center point), and conic-gradient (sweeping around a point like a clock hand). Each serves different design purposes and can be combined for complex effects.

How Linear Gradients Work

A linear gradient creates a color transition along a straight line from a starting point to an ending point. You control the direction by setting an angle (0deg = bottom to top, 90deg = left to right, 180deg = top to bottom). Color stops define where each color appears along the gradient axis.

Basic syntax: linear-gradient(angle, color1 position, color2 position, ...)

Example: linear-gradient(135deg, #db2777 0%, #7c3aed 50%, #2563eb 100%) creates a diagonal gradient from pink through purple to blue.

Radial and Conic Gradients

Radial gradients radiate color outward from a center point in a circular or elliptical shape. They are ideal for spotlight effects, button backgrounds, and circular UI elements. You can adjust the shape (circle or ellipse) and center position.

Conic gradients sweep color around a center point like a fan or pie chart. This is the newest gradient type, supported across all modern browsers since 2020. They are excellent for CSS-only pie charts, color wheels, and artistic effects.

Advanced Gradient Techniques

  • Gradient text: Combine background-clip: text with -webkit-text-fill-color: transparent to create stunning gradient headings.
  • Gradient borders: Use border-image or the pseudo-element trick with a gradient background to create colorful borders.
  • Stacking gradients: You can layer multiple gradients by separating them with commas in the background property.
  • Gradient animation: Animate background-position or background-size to create smooth moving gradient effects that bring interfaces to life.
  • Hard color stops: Place two colors at the same position (e.g., red 50%, blue 50%) to create a sharp cutoff instead of a smooth transition — useful for stripe patterns.

Gradients in Modern Web Design

Gradients have become an essential part of modern web design. Major brands like Instagram, Spotify, and Stripe all use gradients as brand identity elements. Gradients create depth, establish visual hierarchy, and capture attention without heavy image files.

When designing gradients, follow these principles: choose 2-3 adjacent colors on the color wheel for natural transitions, avoid combining complementary (opposite) colors as they create a muddy gray zone in the middle, and always check contrast to ensure text remains readable on gradient backgrounds.

Frequently Asked Questions

Other Tools You Might Like

More in Developer Tools

About Developer Tools

Developer tools automate the repetitive parts of software work: formatting JSON, encoding/decoding Base64, decoding JWTs to verify token claims, generating UUIDs, formatting XML, diffing configurations. These aren't glamorous tasks, but they're the friction points that eat 10-15 minutes multiple times a day — adding up to hours weekly. Running them in a clean browser tab beats wrestling with CLI dependencies or IDE extensions that might ship your private data to a third party.

Why it matters

Fast, client-side developer tools fundamentally matter because they're used with sensitive data. JWT tokens contain user identity. Base64 payloads might encode API keys. JSON dumps include customer records. If a 'developer tool' sends your input to a server to process, you've just leaked production secrets. ZestLab's dev tools run 100% client-side with no network calls after page load — what you paste stays in your browser.

Privacy and safety

All developer tools here execute in-browser using pure JavaScript. There's no 'decode server' or 'format API' — your JWT, your JSON, your encoded payload is parsed by code running on your laptop. Verify this yourself with browser DevTools → Network tab: you'll see zero outbound requests when using any tool. That's a standard we hold because dev tools handle secrets.

Best practices

  • Never paste production JWT or API tokens into ANY online tool without verifying it runs client-side (check the Network tab)
  • Use browser private/incognito mode for one-off decoding of sensitive payloads
  • Bookmark tools you use daily — ZestLab tool URLs are stable and don't require accounts
  • When formatting JSON with secrets for team review, redact credentials before sharing the formatted output