CSS Gradient Generator
Create beautiful CSS gradients visually. Choose linear, radial, or conic modes, add color stops, and copy the generated CSS.
Preview
Color Stops (click to add, drag to move)
Presets
Gradient Type
Direction
135degColor Stops
Generated CSS
background: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
About the CSS Gradient Generator
CSS gradients allow you to create smooth transitions between two or more colors without using images. They reduce HTTP requests, load instantly, and scale perfectly to any resolution, making them ideal for responsive web design. This CSS gradient generator lets you visually design linear, radial, and conic gradients with full control over color stops, direction, and positioning, then copy the generated CSS with one click.
Understanding CSS Gradient Types
Linear gradients transition colors along a straight line defined by an angle. An angle of 0deg goes from bottom to top, 90deg from left to right, and 180deg from top to bottom. They are the most commonly used gradient type, perfect for backgrounds, buttons, and overlays. Radial gradients radiate outward from a center point in either a circular or elliptical shape. They work well for spotlight effects, glowing buttons, and vignette overlays. Conic gradients rotate colors around a center point, similar to a color wheel or pie chart. Introduced in CSS Images Module Level 4, conic gradients are useful for creating pie charts, color wheels, and decorative patterns.
Working with Color Stops
Every CSS gradient requires at least two color stops. Each stop defines a color and its position along the gradient line (expressed as a percentage from 0% to 100%). When you place two stops at the same position, you create a hard color transition instead of a smooth blend. Stops placed further apart produce gentler transitions, while stops closer together produce sharper changes. Modern CSS also supports color hints (midpoints) between stops, giving you even finer control over the transition curve. This tool automatically sorts your stops by position and generates clean, standards-compliant CSS that works across all modern browsers including Chrome, Firefox, Safari, and Edge.
Gradient Best Practices
For production use, consider adding a fallback background-color before the gradient declaration for older browsers. You can layer multiple gradients using comma-separated values in the background property to create complex patterns. When designing for accessibility, ensure that text placed over gradients maintains sufficient contrast (WCAG AA requires 4.5:1 for normal text). Performance-wise, CSS gradients are rendered by the GPU and are significantly more performant than equivalent image backgrounds, especially on high-DPI displays where images need to be 2x or 3x resolution.
Frequently Asked Questions
What types of CSS gradients are there?
CSS supports three gradient types: linear-gradient (colors transition along a straight line), radial-gradient (colors radiate outward from a center point), and conic-gradient (colors rotate around a center point like a color wheel). Each can have multiple color stops at specific positions.
How do I use a CSS gradient as a background?
Apply the gradient using the CSS background property, e.g., background: linear-gradient(90deg, #ff0000 0%, #0000ff 100%). The gradient function replaces a background-color or background-image value. You can also layer multiple gradients separated by commas.
What are color stops in gradients?
Color stops define the colors and their positions along the gradient. Each stop has a color value and an optional position (usually a percentage). The browser interpolates colors smoothly between stops. You need at least two stops for a gradient.
Do CSS gradients work in all browsers?
Yes, CSS gradients are supported in all modern browsers including Chrome, Firefox, Safari, and Edge. Linear and radial gradients have had full support since around 2013. Conic gradients are supported in all current browsers since 2020.