CSS Gradient Generator
Create linear, radial, and conic CSS gradients with real-time preview. Add up to 5 color stops, adjust angles and positions, then copy the generated CSS code.
How the CSS Gradient Generator Works
This tool creates CSS gradient declarations in real time by combining your chosen gradient type, direction or angle, and color stops into a valid CSS background property. As you adjust any parameter, the preview updates instantly and the CSS output reflects your changes. You can copy the generated code directly into your stylesheet for immediate use in any web project.
CSS Gradient Syntax
Linear: background: linear-gradient(angle, color1 pos1, color2 pos2);
Radial: background: radial-gradient(ellipse at center, color1 pos1, color2 pos2);
Conic: background: conic-gradient(from angle, color1 pos1, color2 pos2);
Understanding CSS Gradient Types
CSS supports three main gradient types, each producing a distinct visual effect. Linear gradients create a smooth color transition along a straight line defined by an angle or direction keyword. Radial gradients radiate colors outward from a center point in an elliptical or circular shape. Conic gradients rotate colors around a center point, similar to the sweep of a clock hand, creating pie-chart-like or spectrum effects.
Linear Gradients
Linear gradients are the most commonly used type. The angle parameter controls the direction of the color transition. An angle of 0 degrees creates a bottom-to-top gradient, 90 degrees goes left-to-right, 180 degrees goes top-to-bottom, and 270 degrees goes right-to-left. You can use any angle between 0 and 360 for diagonal or custom directions. Linear gradients are ideal for backgrounds, buttons, headers, and decorative overlays.
Radial Gradients
Radial gradients create color transitions that emanate from a central point outward. The default shape is an ellipse that matches the element proportions, but you can specify a circle for uniform expansion. Radial gradients are commonly used for spotlight effects, vignettes, soft glows behind elements, and creating depth on large surfaces. The color stops define where each color begins and ends along the radius from center to edge.
Conic Gradients
Conic gradients distribute colors by rotating around a center point. Unlike radial gradients which move outward, conic gradients sweep in a circular motion. They are excellent for creating color wheels, pie charts, loading indicators, and decorative backgrounds with sweeping color transitions. The starting angle determines where the first color begins its rotation.
Color Stops and Positioning
Each color stop defines a color and its position along the gradient line. Positions are specified as percentages from 0% (start) to 100% (end). Placing color stops close together creates sharp transitions, while spacing them further apart creates smooth blends. You can add up to 5 color stops in this tool, giving you fine-grained control over the gradient appearance. Strategic placement of stops can create striped effects, smooth rainbows, or subtle two-tone backgrounds.
Browser Compatibility
Linear and radial gradients are supported in all modern browsers including Chrome, Firefox, Safari, and Edge. Conic gradients have slightly newer support but work in all current browser versions. The CSS code generated by this tool uses standard syntax without vendor prefixes, as modern browsers no longer require them for gradient properties.
Privacy and Processing
All gradient generation happens entirely in your browser using JavaScript and CSS. No color data, CSS code, or design information is sent to any server. Your creative work remains completely private.