CSS Gradient Generator
CSS ToolsCreate linear, radial, and conic CSS gradients with live preview. Free, private — all processing in your browser.
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
The CSS Gradient Generator is a free online visual tool for creating linear, radial, and conic CSS gradients. Build gorgeous color transitions with a drag-and-drop color stop editor, fine-tune the gradient angle and position, preview the result in real-time, and copy the exact CSS code ready to paste into your stylesheet. Supports unlimited color stops, custom stop positions (percentages or pixels), opacity per stop, and all three modern gradient functions: linear-gradient(), radial-gradient(), and conic-gradient() (the newest, added in 2020). Plus gradient text, gradient borders, and animated gradients with @keyframes.
Gradients are everywhere in modern design: hero section backgrounds, button hover states, card accents, loading shimmer effects, dividers, CTA overlays, and increasingly in branding (Instagram's iconic gradient, Stripe's purple-to-red, etc.). Hand-writing gradient CSS is error-prone — getting the angles, stops, and color mixing right takes experimentation. This tool makes it visual and instant. All generation is client-side, so you can iterate rapidly without network delays.
CSS Gradient Generator — key features
Linear, radial, conic gradients
All three CSS gradient types. Switch between them without losing your color stops.
Visual color stop editor
Drag color stops along the gradient bar. Click to add new stops. Right-click to remove.
Custom angles and positions
Set exact angle for linear, center position for radial, starting angle for conic. Fine-tune for pixel-perfect results.
Per-stop opacity
Each color stop has its own alpha value. Create gradients that fade to transparent.
Real-time preview
See the gradient update instantly as you change any setting. Full-screen preview mode available.
Copy CSS code
Generated CSS is cross-browser compatible and ready to paste. Includes vendor prefixes for older browsers if needed.
Preset gradients
Hundreds of curated gradient presets — sunset, ocean, forest, neon, pastel, brand-inspired. Click to start.
Export as image
Save the gradient as a PNG or SVG for use in design tools, presentations, or as a fallback image.
How to use the CSS Gradient Generator
- 1
Choose gradient type
Linear for simple transitions, radial for glow/spotlight effects, conic for rainbow/pie-chart effects.
- 2
Pick your colors
Click on the color stops and choose colors. Add stops by clicking on the gradient bar. Drag to reposition.
- 3
Set angle or position
For linear: set the angle (0°=up, 90°=right, 180°=down, 270°=left). For radial: set shape and center.
- 4
Add opacity for transparent fade
Set alpha values on color stops to create gradients that fade to transparent edges.
- 5
Preview the result
See the gradient applied to a sample box. Full-screen preview shows how it looks at size.
- 6
Copy the CSS
Click Copy to put the gradient CSS on your clipboard. Paste into your CSS file, Tailwind config, or any styled component.
Common use cases for the CSS Gradient Generator
Web design
- →Hero section backgrounds: Modern websites use gradient backgrounds for hero sections — adds visual interest without competing with text.
- →Button hover effects: Gradient backgrounds on buttons provide depth and interactivity. Change gradient on hover for feedback.
- →Card and panel accents: Subtle gradients on cards (e.g., `linear-gradient(145deg, white, #f5f5f5)`) add depth without being distracting.
- →CTA overlays: Gradient overlays on images help text stand out — `linear-gradient(rgba(0,0,0,0.6), transparent)` over a photo.
Branding
- →Brand color gradients: Many brands use gradients as part of their identity. Instagram (pink-to-orange), Stripe (purple-to-red), Netflix (dark-to-black).
- →Logo backgrounds: Put a gradient behind a logo for a modern feel.
- →Animated brand gradients: Shifting gradients on landing pages create dynamic, modern brand expression.
UI/UX patterns
- →Loading skeletons: Animated linear gradients with shimmer effect signal loading state while content fetches.
- →Dividers and section transitions: Gradient lines or panels mark transitions between page sections.
- →Progress bars: Gradient fill on progress bars indicates progression visually.
- →Chart and data visualization: Gradient fills on bar/area charts differentiate series and add visual depth.
Creative effects
- →Gradient text: Use `background-clip: text` to apply gradient to text. Striking headlines, especially in SaaS marketing.
- →Glassmorphism: Semi-transparent gradients combined with blur create the glass-like UI trend.
- →Neon glow effects: Radial gradients with transparent edges simulate neon glows around elements.
- →Conic rainbow loaders: Conic gradients spinning via CSS animation create modern loading indicators.
CSS Gradient Generator — examples
Classic linear gradient
Simple left-to-right fade.
Direction: to right Colors: #ff0000, #0000ff
background: linear-gradient(to right, #ff0000, #0000ff);
Multi-stop sunset
Smooth transition through 4 colors.
Linear 135deg Stops: #ff6b6b 0%, #ffa500 30%, #ffeb3b 60%, #fff9c4 100%
background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 30%, #ffeb3b 60%, #fff9c4 100%);
Radial spotlight
Light effect emanating from top-left.
Shape: circle, at top left Colors: yellow 0%, transparent 70%
background: radial-gradient(circle at top left, yellow 0%, transparent 70%);
Conic rainbow
Circular rainbow pattern.
From 0deg Red, yellow, green, blue, purple, red (full cycle)
background: conic-gradient(from 0deg, red, yellow, green, blue, purple, red);
Text gradient
Gradient-colored heading text.
Linear gradient on text
.title {
background: linear-gradient(to right, #e91e63, #ff9800);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}Glassmorphism card
Semi-transparent gradient with blur.
RGBA gradient + backdrop-filter
.card {
background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
backdrop-filter: blur(20px);
border: 1px solid rgba(255,255,255,0.3);
}Animated shimmer
Loading-skeleton shimmer effect.
Animated linear with keyframes
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.skeleton {
background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
}Technical details
CSS supports three types of gradients defined in the CSS Images Module Level 3 and 4 specs:
Linear gradient:
```css
background: linear-gradient(direction, color-stop1, color-stop2, ...);
/* Examples: */
background: linear-gradient(to right, #ff0000, #0000ff);
background: linear-gradient(45deg, red, yellow 50%, blue);
background: linear-gradient(to bottom right, #ff0000 0%, #ffa500 50%, #ffff00 100%);
```
- Direction: to top, to right, to bottom, to left, to top right, etc., or an angle (45deg, 90deg).
- Color stops: each is a color + optional position (% or length). Without position, stops are evenly distributed.
- Supports alpha (transparency) in color values.
Radial gradient:
```css
background: radial-gradient(shape size at position, color-stop1, color-stop2, ...);
/* Examples: */
background: radial-gradient(circle, red, blue);
background: radial-gradient(circle at top, red 0%, blue 50%, green 100%);
background: radial-gradient(ellipse 200px 100px at center, red, transparent);
```
- Shape: circle or ellipse (default).
- Size: closest-side, closest-corner, farthest-side, farthest-corner (default), or explicit dimensions.
- Position: at top, at 30% 50%, etc. (defaults to center).
Conic gradient:
```css
background: conic-gradient(from angle at position, color-stop1, color-stop2, ...);
/* Examples: */
background: conic-gradient(red, yellow, green, blue, red);
background: conic-gradient(from 45deg at 50% 50%, #ff0000 0deg, #00ff00 120deg, #0000ff 240deg, #ff0000 360deg);
```
- Rotates colors around a center point, like a pie chart.
- Supported in all modern browsers since ~2020.
- Color stops use angles (deg, turn, rad) instead of percentages.
Multiple backgrounds:
CSS allows layered gradients for complex effects:
``css``
background:
linear-gradient(135deg, rgba(0,0,0,0.5), transparent),
radial-gradient(circle at top right, red, transparent),
url('photo.jpg');
Each layer stacks from top (first) to bottom (last). Use transparent or rgba() for transparency between layers.
Text gradients:
``css``
.gradient-text {
background: linear-gradient(to right, red, blue);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
Animated gradients:
``css``
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.loading {
background: linear-gradient(90deg, transparent 0%, #ddd 50%, transparent 100%);
background-size: 200% 100%;
animation: shimmer 2s infinite;
}
Color interpolation:
- Default gradients interpolate in sRGB — often produces muddy mid-tones (e.g., blue to yellow goes through gray).
- CSS Color 4 adds in oklch and in lab interpolation methods:
``css``
background: linear-gradient(in oklch to right, blue, yellow);
Produces cleaner, more saturated mid-tones. Supported in modern browsers (2023+).
Common problems and solutions
⚠Gradient in sRGB produces muddy colors
Default interpolation in sRGB produces a dark/gray midpoint when transitioning between saturated colors (e.g., blue to yellow goes through gray). Use `in oklch` interpolation: `linear-gradient(in oklch to right, blue, yellow)` for clean, saturated mid-tones. Supported in modern browsers.
⚠Gradient banding
Wide gradients can show visible banding (stripes where colors transition). Reduce by: using an 8-bit-noise pattern overlay, adding very slight noise with SVG filter, using rich colors (avoid near-white gradients), or using a PNG/SVG fallback for critical cases.
⚠Browser compatibility
Modern gradient syntax works in all browsers from 2018+. Vendor prefixes (`-webkit-`, `-moz-`) are no longer needed for gradients. If supporting IE11, use a solid background color fallback and accept gradient unavailability.
⚠Text on gradients hard to read
Gradient backgrounds often have varying contrast. Add a semi-transparent color overlay behind text, use text-shadow for readability, or position text over the most uniform part of the gradient.
⚠Too many color stops
Gradients with 10+ stops quickly become muddy and lose visual impact. Keep to 2-5 stops for most use cases. Use multiple separate gradient backgrounds instead of one complex gradient if needed.
⚠Gradient on a very large element
CSS gradients are computed once and stretched. Large backgrounds (4K+ hero) may show banding or soft edges. Consider using an SVG gradient or image fallback for pixel-perfect rendering at scale.
⚠Animated gradient performance
Animating `background-position` (for shimmer effect) is relatively cheap. Animating the gradient stops themselves is expensive — the browser re-paints every frame. Use `will-change: background-position` and limit animation to specific areas.
⚠Conic gradient angle confusion
In conic-gradient, angles refer to positions around the center, not the gradient direction like linear. `0deg` starts at 12 o'clock. Colors fill clockwise. If your conic gradient looks wrong, the angles may be confusing.
CSS Gradient Generator — comparisons and alternatives
CSS gradient vs image gradient: CSS gradients are resolution-independent, tiny in file size (part of CSS), and instantly customizable. Image gradients (PNG/JPG) support more complex patterns but are fixed. Prefer CSS gradients for 95% of cases.
Linear vs radial vs conic: Linear for directional fades (top-to-bottom, left-to-right, diagonal). Radial for spotlight/glow effects emanating from a point. Conic for pie-chart/rainbow effects that sweep around a center (newest, most unique). Each has its place.
CSS gradient vs SVG gradient: SVG gradients offer more control (mesh gradients, custom color spaces, advanced gradient transforms) and are great for logos/illustrations. CSS gradients are simpler for web backgrounds. For most web use, CSS is fine.
Gradient vs solid color: Gradients add depth and visual interest. Solid colors are simpler and faster to process. For brand consistency, pick one approach and stick with it — don't mix heavy gradients and flat colors inconsistently.
sRGB interpolation vs OKLCH interpolation: Default sRGB interpolation produces muddy mid-tones for saturated colors. in oklch produces perceptually uniform, vibrant gradients. Use in oklch or in lab for gradient quality, especially with saturated colors.
Mesh gradients vs linear/radial: Mesh gradients (in design tools like Figma, Sketch) blend multiple points with individual colors. Not yet in CSS. Workaround: layer multiple radial gradients for a mesh-like effect.
Frequently asked questions about the CSS Gradient Generator
▶What is a CSS gradient?
A CSS gradient is a smooth color transition defined entirely in CSS — no image needed. Three types: linear (straight line direction), radial (emanating from a point), and conic (rotating around a point). Supported in all modern browsers. Resolution-independent, tiny file size, instantly customizable.
▶How do I create a CSS gradient?
Use the linear-gradient(), radial-gradient(), or conic-gradient() functions in your CSS. Example: background: linear-gradient(to right, red, blue);. Add color stops with positions for more control: linear-gradient(to right, red 0%, yellow 50%, blue 100%).
▶What gradient angles should I use?
0deg points up, 90deg points right, 180deg points down, 270deg points left. Diagonal: 45deg (up-right), 135deg (down-right), etc. CSS also accepts keywords: to right, to bottom left. The angle defines where the gradient ends — colors transition perpendicular to this direction.
▶Can I animate CSS gradients?
Yes, but with caveats. Directly animating gradient colors via @keyframes is expensive (full repaint each frame). The common pattern is to animate background-position on a wider gradient: create a 200% wide gradient, then animate position from -100% to 100%. Use will-change for better performance.
▶How do I make text with a gradient?
Use background-clip: text and color: transparent: apply the gradient as background and clip it to the text shape. Example: .title { background: linear-gradient(to right, red, blue); -webkit-background-clip: text; background-clip: text; color: transparent; }.
▶What is a conic gradient?
A conic gradient rotates colors around a center point (like a clock face or color wheel). Added to CSS in 2020. Use cases: pie charts, angular color wheels, circular rainbow loaders, spirals. Syntax: conic-gradient(from 0deg at 50% 50%, red, yellow, green, blue, red).
▶Why does my gradient look dark/gray in the middle?
Default sRGB color interpolation produces a gray midpoint when transitioning between saturated complementary colors (blue + yellow, red + green). Fix: use linear-gradient(in oklch to right, blue, yellow) — OKLCH interpolation produces vibrant mid-tones. Supported in modern browsers.
▶Can I use multiple gradients on one element?
Yes. background accepts a comma-separated list of multiple gradients (and images), layered top to bottom: background: linear-gradient(to right, red, transparent), url(photo.jpg);. Use transparent or rgba() for alpha so lower layers show through.
▶Do gradients work on older browsers?
Modern CSS gradients (without prefixes) work in all browsers from ~2015. IE11 requires -ms- or -webkit- prefixes and doesn't support all syntax. Conic gradients are 2020+ in Chrome/Safari, slightly later elsewhere. For critical cases, provide a solid background fallback.
▶How many color stops can I use?
Unlimited in the CSS spec, but realistically 2-5 produces the best-looking gradients. 10+ stops become muddy. For complex color patterns, layer multiple simpler gradients.
Additional resources
- MDN — linear-gradient — Official linear-gradient reference.
- MDN — radial-gradient — Radial gradient reference.
- MDN — conic-gradient — Conic gradient reference.
- CSS Images Module Level 4 — Full CSS gradient specification.
- uiGradients — Community gallery of pre-made gradients.
Related tools
All CSS ToolsColor Contrast Checker
Check color contrast ratios between foreground and background for WCAG 2.1 AA and AAA compliance with live preview.
Color Converter
Convert between HEX, RGB, HSL, HSV, CMYK, Lab, LCH color formats
Color Palette Generator
Generate harmonious color palettes from any base color with complementary, analogous, triadic, and monochromatic schemes.
Color Shades Generator
Generate tints (lighter), shades (darker), and tones (desaturated) from any base color for design systems and UI states.
CSS Animation Generator
Build CSS keyframe animations and transitions with live preview and easing curves
CSS Border Radius Generator
Generate CSS border-radius — from simple rounded corners to organic blob shapes
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →