Published: April 2026 • 10 min read • Design Tools
Gradients are one of the most powerful visual tools in a web designer's toolkit. They add depth, dimension, and polish to backgrounds, buttons, cards, and hero sections โ all without a single image file. Our free CSS gradient generator lets you create, customize, and export beautiful gradients with a live preview, making it easy to go from concept to production-ready CSS code.
In this guide, we'll cover the three types of CSS gradients, walk through real-world examples, and show you how to use our generator to build stunning visual effects for your projects.
Build linear, radial, and conic gradients with live preview and one-click CSS export.
A CSS gradient is a smooth transition between two or more colors, created entirely with CSS code โ no images required. Browsers render gradients natively, which means they're resolution-independent, load instantly, and can be animated with CSS transitions.
CSS supports three types of gradients:
Each type has distinct use cases and visual characteristics. Understanding when to use each one is key to creating effective designs.
Linear gradients are by far the most commonly used type. The syntax is straightforward:
background: linear-gradient(direction, color1, color2, ...);
The direction can be specified as an angle (0deg to 360deg) or using keywords like to right, to bottom, or to bottom right. Here are some popular examples:
to right
to bottom
to bottom right
/* Indigo to purple, 135 degrees */ background: linear-gradient(135deg, #6366f1, #a855f7);
/* Orange to red, left to right */ background: linear-gradient(to right, #f97316, #ef4444);
You can add multiple color stops to create more complex gradients. Each stop can include a position percentage:
/* Multi-stop gradient with positioned stops */ background: linear-gradient(to right, #6366f1 0%, #a855f7 50%, #ec4899 100%);
Radial gradients create a circular or elliptical transition from a center point outward. They're perfect for spotlight effects, vignettes, and creating a sense of depth.
/* Simple radial gradient */ background: radial-gradient(circle, #6366f1, #0f0f1a); /* Elliptical gradient with positioned center */ background: radial-gradient(ellipse at top left, #fbbf24, #f97316, #dc2626);
Radial gradients are particularly effective for card backgrounds, modal overlays, and hero sections where you want to draw the viewer's eye toward a central focal point.
Conic gradients rotate colors around a center point, similar to the hands of a clock. They're newer but incredibly versatile for creating pie charts, color wheels, and unique decorative backgrounds.
/* Color wheel effect */ background: conic-gradient(#ef4444, #f97316, #eab308, #22c55e, #3b82f6, #8b5cf6, #ef4444); /* Pie chart using conic-gradient */ background: conic-gradient(#6366f1 0% 40%, #a855f7 40% 70%, #ec4899 70% 100%);
Open the gradient generator and select between linear, radial, and conic modes. Each mode exposes relevant controls โ angle for linear, position and shape for radial, and starting angle for conic.
Add color stops by clicking the "+" button. Each stop has a color picker and a position slider (0โ100%). You can use HEX, RGB, or named colors. The live preview updates instantly as you make changes.
For linear gradients, drag the angle control or type a specific degree value. For radial gradients, adjust the shape (circle vs. ellipse) and center position. The preview updates in real time.
Once you're happy with the result, click "Copy CSS" to get the production-ready code. The output includes vendor prefixes for maximum browser compatibility. You can also copy the gradient as a Tailwind CSS class or a Figma-compatible value.
Let's create a hero section background that transitions from deep indigo to vibrant purple with a subtle blue accent:
/* Hero section gradient */ .hero { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4f46e5 70%, #7c3aed 100%); min-height: 100vh; }
Using our generator, you'd set four color stops at 0%, 30%, 70%, and 100%, then adjust the angle to 135ยฐ. The live preview lets you experiment until the transition feels just right.
Gradient backgrounds pair beautifully with glassmorphism effects:
/* Background with gradient */ .card-bg { background: linear-gradient(135deg, #6366f1, #ec4899); } /* Glass card on top */ .glass-card { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 16px; padding: 24px; }
Tip: Use our HEX to RGB converter to quickly get the RGBA values you need for glassmorphism overlays.
.gradient-text { background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #6366f1); background-size: 300% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: shimmer 3s ease infinite; } @keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
Layer multiple radial gradients to approximate the popular mesh gradient look:
.mesh-gradient { background: radial-gradient(at 20% 20%, rgba(99, 102, 241, 0.5), transparent 50%), radial-gradient(at 80% 30%, rgba(168, 85, 247, 0.5), transparent 50%), radial-gradient(at 50% 80%, rgba(236, 72, 153, 0.5), transparent 50%), #0f0f1a; }
Gradients create visually striking first impressions without requiring large image files. A well-chosen gradient communicates brand personality โ cool blues for trust, warm oranges for energy, purples for creativity.
Buttons, progress bars, sliders, and toggle switches all benefit from gradient fills. A gradient button naturally draws attention and signals interactivity.
Subtle gradients add visual interest to dark interfaces without overwhelming the user. Low-contrast gradients between dark shades create depth while maintaining readability.
Gradient backgrounds are a staple of modern social media design. Instagram stories, Twitter headers, and YouTube thumbnails frequently use bold gradients to stand out in crowded feeds.
Yes. All modern browsers (Chrome, Firefox, Safari, Edge) support linear, radial, and conic gradients. Our generator includes vendor prefixes for older browser versions. IE11 supports linear and radial gradients with the -ms- prefix, but does not support conic gradients.
-ms-
You can animate gradient properties like background-position and background-size using CSS keyframes, but you cannot directly animate between two different gradients using CSS transitions. For smooth gradient-to-gradient animations, consider using the CSS @property rule or layering multiple gradients with opacity transitions.
@property
A linear-gradient transitions once from start to finish, while a repeating-linear-gradient repeats the pattern infinitely. Repeating gradients are useful for striped patterns, progress indicators, and decorative backgrounds.
linear-gradient
repeating-linear-gradient
Tailwind CSS supports gradients via utility classes like bg-gradient-to-r and from-indigo-500 via-purple-500 to-pink-500. Our generator provides Tailwind-compatible output so you can copy the classes directly into your project.
bg-gradient-to-r
from-indigo-500 via-purple-500 to-pink-500
Absolutely. You can add as many color stops as you need. Three-color gradients are very popular for creating richer transitions. Just add stops in our generator and adjust their positions to control where each color appears in the gradient.
Convert color codes between formats
Ensure your gradients meet accessibility standards
Placeholder text for your gradient mockups
CSS gradients are a versatile, performant way to add visual richness to your web projects. Whether you're designing a landing page, building a component library, or experimenting with creative backgrounds, our CSS gradient generator gives you the tools to create professional gradients in seconds โ no guesswork, no manual coding, just beautiful results.