CSS Gradient Generator

Create CSS gradients visually with linear, radial, and conic types. Add color stops, adjust angles, and copy the generated code.

Ad
Ad

About CSS Gradient Generator

CSS gradients create smooth transitions between colours without using images. This generator supports all three CSS gradient types - linear, radial, and conic - with a visual editor for colour stops, angles, and positions. Adjust sliders, see the result instantly, and copy the generated CSS.

The Three CSS Gradient Types

TypeCSS FunctionWhat It DoesBest For
Linearlinear-gradient()Transitions along a straight line at any angleBackgrounds, headers, buttons, overlays
Radialradial-gradient()Spreads outward from a centre pointSpotlight effects, vignettes, orbs
Conicconic-gradient()Sweeps around a centre point like a colour wheelPie charts, loading spinners, decorative rings

Linear gradients are by far the most commonly used. Radial gradients are useful for focus effects. Conic gradients are newer (supported since ~2020) and enable effects that previously required SVG or canvas.

Understanding the Syntax

linear-gradient(135deg, #667eea 0%, #764ba2 100%)

PartMeaning
135degAngle - 0deg goes bottom-to-top, 90deg goes left-to-right, 135deg is diagonal top-left to bottom-right
#667eea 0%First colour stop at the start (0%)
#764ba2 100%Second colour stop at the end (100%)

You can add as many colour stops as you want. Each stop has a colour and a position (0-100%). Stops closer together create sharper transitions; stops further apart create smoother fades. If you skip the percentage, the browser distributes stops evenly.

Common Gradient Angles

AngleDirectionKeyword Equivalent
0degBottom to topto top
45degBottom-left to top-rightto top right
90degLeft to rightto right
135degTop-left to bottom-rightto bottom right
180degTop to bottom (default)to bottom
270degRight to leftto left

Gradient Design Tips

TipWhy
Use colours from the same hue familyPrevents muddy grey zones in the middle of the transition
Add a mid-stop for smoother blendsA third colour between two stops can eliminate the grey band
Keep text contrast highGradient backgrounds make text harder to read - check with a contrast checker
Use opacity for overlayslinear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)) over an image darkens it for text readability
Animate the background-position, not the gradient itselfAnimating gradient definitions is not performant. Instead, create an oversized gradient and animate background-position for smooth movement.

Layering Multiple Gradients

CSS lets you stack multiple backgrounds, including gradients. This enables complex effects without images:

background: linear-gradient(135deg, rgba(102,126,234,0.8) 0%, transparent 50%), linear-gradient(225deg, rgba(118,75,162,0.8) 0%, transparent 50%), #f0f0f0;

The first gradient covers the top-left, the second covers the bottom-right, and the solid colour fills the rest. This technique is used for mesh gradient approximations and decorative hero sections.

Gradients vs Images

CSS GradientImage File
File sizeZero - defined in CSSAdds to page weight (5-100+ KB)
Resolution independenceAlways sharp at any sizeCan blur at high DPI or large sizes
EditabilityChange colours in code instantlyRequires image editing software
ComplexityLimited to gradient functionsUnlimited visual complexity
AnimationLimited but possible via background-positionUse sprite sheets or CSS animation
Browser supportAll modern browsersUniversal

For most background effects, CSS gradients are the better choice - they load instantly, scale perfectly, and are easy to modify. Only reach for images when you need photographic or highly complex textures.

Browser Support

Linear and radial gradients have been supported unprefixed in all major browsers since 2013. Conic gradients reached full support in 2020 (Chrome 69+, Firefox 83+, Safari 12.1+). No vendor prefixes are needed for any gradient type in modern browsers.

Combine your gradients with custom shadows from the CSS Box Shadow Generator for layered visual effects. Check text readability over gradients with the Color Contrast Checker.

All processing happens in your browser. Nothing is uploaded to any server.

Frequently Asked Questions

What gradient types are supported?

The tool supports all three CSS gradient types - linear, radial, and conic. Linear gradients flow in a straight line at any angle. Radial gradients spread outward from a center point. Conic gradients sweep around a center point, useful for pie chart effects and color wheels.

How many color stops can I add?

You can add as many color stops as you need, with a minimum of two. Each stop has its own color picker and position slider (0% to 100%). You can reorder stops using the arrow buttons and remove any stop as long as at least two remain.

Can I use the presets as a starting point?

Yes. The preset buttons instantly apply a gradient configuration including type, angle, and color stops. After applying a preset, you can freely modify any setting to customize it further. Presets are a quick way to start with a proven color combination.

Is this tool free and private?

Completely free with no sign-up required. All gradient calculations happen in your browser. Nothing is sent to any server, so your design work stays private.

What does the angle control do?

For linear gradients, the angle sets the direction of the gradient flow in degrees. 0 degrees goes bottom to top, 90 degrees goes left to right, and so on. For conic gradients, the angle sets the starting rotation. Radial gradients do not use an angle since they spread outward from the center.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/css-gradient-generator/" title="CSS Gradient Generator - Free Online Tool">Try CSS Gradient Generator on ToolboxKit.io</a>