CSS Gradient Generator - Visual Gradient Maker
Create CSS linear and radial gradients visually. Pick colors, adjust the angle, add multiple color stops, and copy the generated CSS code. Live preview updates as you edit.
Generated CSS
What Is a CSS Gradient?
A CSS gradient is a smooth transition between two or more colors rendered by the browser. Unlike image-based backgrounds, CSS gradients are resolution-independent (they scale perfectly on any screen), load instantly (no HTTP request needed), and can be animated or adjusted dynamically. They are defined using the background or background-image CSS property with the linear-gradient() or radial-gradient() function.
Linear Gradients
A linear gradient creates a color transition along a straight line. The line's direction is specified by an angle (in degrees) or a keyword (to right, to bottom left). At 0deg the gradient goes from bottom to top; at 90deg it goes from left to right. Color stops define what color appears at what point along the line.
/* Basic two-color gradient */
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
/* Three-color gradient */
background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #4facfe 100%);
/* Gradient with specific stop positions */
background: linear-gradient(to right, #00c6ff 0%, #0072ff 30%, #7209b7 100%); Radial Gradients
A radial gradient radiates colors outward from a center point. By default, it creates a circle or ellipse that matches the element's shape. Radial gradients are perfect for spotlight effects, glowing buttons, or simulating depth and dimension.
/* Basic radial gradient */
background: radial-gradient(circle, #667eea 0%, #764ba2 100%);
/* Elliptical gradient */
background: radial-gradient(ellipse at center, #f8f9fa 0%, #dee2e6 100%); Color Stops Explained
Each color stop has two components: a color value and a position (usually a percentage). The position tells the browser where that color should be at full intensity along the gradient line. Between stops, the browser smoothly interpolates the colors.
- Two stops at 0% and 100%: A simple two-color blend across the entire element.
- Hard stops: Place two different colors at the same position (e.g.,
red 50%, blue 50%) to create a sharp color boundary with no transition. - Multiple stops: Add intermediate stops to create complex rainbow effects or brand-specific color sequences.
- Transparent stops: Use
transparentas a color to fade into the element's background.
Common Gradient Patterns
| Pattern | CSS | Use Case |
|---|---|---|
| Horizontal blend | linear-gradient(90deg, ...) | Section backgrounds, hero banners |
| Diagonal blend | linear-gradient(135deg, ...) | Cards, buttons, dynamic backgrounds |
| Top to bottom | linear-gradient(180deg, ...) | Page sections, header overlays |
| Center glow | radial-gradient(circle, ...) | Spotlight effects, featured content |
Performance and Best Practices
- CSS gradients are rendered by the GPU and perform well, even in animations.
- Prefer CSS gradients over image files for simple color transitions to reduce HTTP requests and page weight.
- Keep the number of color stops reasonable (2-5) for best visual results. Too many stops can look muddy.
- Test gradients on both light and dark mode backgrounds if your site supports theme switching.
- Use the
background-sizeproperty with gradients to create repeating patterns. - All modern browsers support CSS gradients without vendor prefixes.
Gradients in Design Systems
Many design systems use gradients as brand elements. Instagram's logo gradient, Stripe's signature purple-blue gradient, and Spotify's green-to-dark gradient are instantly recognizable. When building a design system, define gradient tokens alongside your color palette to ensure consistent usage across the application. Store gradients as CSS custom properties for easy theming:
:root {
--gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-accent: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
}
.hero {
background: var(--gradient-primary);
} Frequently Asked Questions
How do I create a CSS gradient?
Use the visual controls above to pick your gradient type (linear or radial), select colors for each stop, set the angle for linear gradients, and adjust stop positions. The CSS code is generated in real time. Click the Copy button to copy the CSS background property and paste it into your stylesheet.
What is the difference between linear and radial gradients?
Linear gradients transition along a straight line (e.g., left to right, top to bottom, or at any angle). Radial gradients transition outward from a center point in a circular or elliptical shape. Linear gradients are more commonly used for section backgrounds and hero banners, while radial gradients create spotlight, glow, or depth effects.
How many color stops can I add?
There is no hard limit on color stops. You can add as many as you need. Each stop has a color value and a position from 0% to 100%. The browser smoothly interpolates between adjacent stops. Two stops create a simple blend; three or more create multi-color transitions. For most designs, 2-4 stops produce the cleanest results.
Do CSS gradients work in all browsers?
Yes. CSS gradients are fully supported in all modern browsers: Chrome, Firefox, Safari, Edge, Opera, and their mobile counterparts. No vendor prefixes (-webkit-, -moz-) are needed for current browser versions. Support goes back to IE 10 for basic linear gradients.