CSS gradients let you create smooth color transitions without any image files, making your website faster and more visually appealing. Whether you are building a landing page hero section, button backgrounds, or decorative dividers, a CSS gradient generator saves you from writing gradient syntax by hand. In this guide, we cover linear gradients, radial gradients, and conic gradients with real code examples you can copy directly into your project.
A CSS gradient is a special type of image created by the browser that transitions between two or more colors. Because gradients are generated by the browser using CSS properties, they load instantly, scale to any size without pixelation, and add zero bytes to your page weight compared to a PNG or JPG image.
The background or background-image property accepts gradient functions. The three main types are linear-gradient, radial-gradient, and conic-gradient.
A linear gradient transitions colors along a straight line. You control the direction using an angle or a keyword like to right, to bottom right, and so on.
Here is a gradient going from left to right, transitioning from indigo to pink:
.btn-primary {
background: linear-gradient(to right, #4F46E5, #EC4899);
}You can set a precise angle in degrees. 0deg points upward, 90deg points right, 180deg points down:
.hero {
background: linear-gradient(135deg, #312e81 0%, #4F46E5 50%, #818cf8 100%);
}Using percentage stops gives you finer control over where each color begins and ends. The 135deg angle creates a diagonal that works well for hero sections and call-to-action buttons.
A radial gradient radiates outward from a center point. This works well for spotlight effects, glowing buttons, and circular backgrounds.
.spotlight {
background: radial-gradient(circle at center, #fbbf24 0%, #f59e0b 40%, #78350f 100%);
}You can shift the center point using at top left, at 30% 70%, or any position value to control where the brightest color starts.
Conic gradients sweep around a center point like a pie chart. They are useful for creating color wheels, pie charts, and unique decorative backgrounds:
.color-wheel {
background: conic-gradient(from 0deg, #ef4444, #f59e0b, #eab308, #22c55e, #3b82f6, #8b5cf6, #ef4444);
}Using rgba() instead of hex lets you control opacity, which is great for overlay gradients on top of images:
.overlay {
background: linear-gradient(to bottom, rgba(30,27,75,0.1), rgba(30,27,75,0.9));
}background-attachment: fixed for a parallax-style gradient background.background-color for older browsers.Writing gradient syntax by hand gets tedious, especially when you want to fine-tune color stops and angles. Our free gradient generator lets you pick colors visually, adjust the angle, add or remove stops, and copy the generated CSS code with a single click. This speeds up your workflow and helps you experiment with combinations before committing.
CSS gradients are a powerful, lightweight way to add visual interest to any web page. Mastering linear, radial, and conic gradients gives you the flexibility to create everything from subtle backgrounds to bold hero sections. Try our free CSS gradient generator to build your next gradient in seconds.
Use our free online calculators and tools for all your needs.
Browse All 213+ Tools โ