Color Palette Generator
Generate beautiful color palettes from base colors or images. Supports 6 harmony types, image color extraction, and multiple export formats
CSS Gradient Generator is a free tool to create and preview linear, radial, and conic CSS gradients with multiple color stops and instant CSS code output.
Gradients in CSS have come a long way from the era when achieving a simple two-color fade required a 1-pixel tall image tiled horizontally across the background. That approach worked, technically, in the same way that a paper map works when your phone dies. It gets the job done and nobody is happy about it.
CSS gradients are now powerful enough to replace image assets entirely in most design contexts, load faster, scale infinitely, and respond to dynamic values in ways that static images never could. The property syntax is also expressive enough that writing it from memory without immediately needing to check the result is genuinely unrealistic for anything beyond the simplest cases. This tool handles the visual configuration and generates the code.
CSS supports three distinct gradient functions, each producing a fundamentally different kind of transition.
Linear gradients transition colors along a straight line in a defined direction. The direction is specified as an angle in degrees or using keyword values like to right, to bottom right, or to top. The most common use cases are horizontal and diagonal backgrounds, button fills, text gradients, and decorative dividers. A linear gradient from top to bottom at 0 degrees is the default when no direction is specified.
Radial gradients transition colors outward from a center point in a circular or elliptical shape. The gradient starts at the center and spreads outward, with color stops defining where each color appears in that spread. The shape can be forced to a circle or left as an ellipse that fits the element's dimensions. The center position can be placed anywhere using the at keyword with position values. Radial gradients work well for spotlight effects, glows, circular backgrounds, and anything that needs to suggest a light source coming from a specific point.
Conic gradients transition colors around a center point rather than outward from it, like the segments of a pie chart. The colors sweep around the center in a circle, defined by angular positions rather than radial distances. Conic gradients are newer than the other two and have full browser support in all modern environments. They are useful for pie charts in pure CSS, color wheels, segmented loader animations, and distinctive geometric backgrounds that neither linear nor radial gradients can produce.
Every gradient is defined by at least two color stops, which are the specific colors the gradient transitions between. Adding more color stops allows for multi-color transitions, hard edges, and complex patterns.
Each color stop has a color value and an optional position. The position is expressed as a percentage of the gradient's total length or radius. Without explicit positions, the browser distributes color stops evenly. With explicit positions, you control exactly where each transition begins and ends.
Hard color stops, where one color ends and another begins at the same position without any transition, are created by placing two stops at the same percentage or placing a stop at the same position as the end of the previous one. This technique produces striped and segmented patterns from a single CSS property value, which is genuinely useful for certain design contexts.
Color stop positions do not have to fall in neat intervals. Placing a stop at 20% and the next at 80% concentrates the transition in the middle 60% of the gradient and holds solid colors at the edges. This kind of control is what separates a gradient that looks considered from one that looks like a default.
The live preview renders the gradient on an actual element rather than in an abstract swatch, so you can evaluate how the colors and transitions will look in a real layout context before committing to the values.
Background fills. Replacing flat background colors with subtle gradients adds depth without adding any visual noise. A near-imperceptible linear gradient from a slightly lighter to slightly darker shade of the same color creates dimensionality on surfaces that flat color cannot. The key word is subtle. Gradients that look designed are gradients you notice for the right reasons.
Button and interactive element styling. Gradient-filled buttons have gone in and out of fashion, but done with restraint they remain a legitimate way to make interactive elements feel more three-dimensional. A gentle top-to-bottom gradient on a button with a lighter shade at the top reads as a lit surface. Combined with a box shadow, which the CSS Box Shadow Generator handles, the result can look genuinely polished.
Text gradients. Applying a gradient to text uses background-clip: text combined with the gradient as a background. It requires setting color: transparent on the text element. The effect is visually distinctive and works well for headings, display type, and brand elements where a flat color feels insufficient.
Section dividers and decorative elements. A full-width div with a carefully chosen gradient and fixed height creates a smooth visual transition between page sections without requiring any image assets. This approach scales to any viewport width and responds to layout changes cleanly.
Mesh and noise backgrounds. Multiple radial gradients layered via the background property, each with different colors, sizes, and positions, create the organic multi-color mesh gradient effect that became widespread in UI design over the past few years. This is achievable in pure CSS by comma-separating multiple radial-gradient() calls on the same background property.
The practical advantages of CSS gradients over image-based backgrounds are significant enough to be worth naming directly. CSS gradients are defined in code, meaning they scale to any size without pixelation or quality loss. They do not require an HTTP request to load, removing a network round trip that image assets require. They can be changed through CSS variables or custom properties, enabling dynamic theming. They respond to CSS animations and transitions.
For cases where a gradient background needs specific artistic qualities or photographic detail that CSS cannot produce, image assets are still the right choice. The PNG Gradient Background Generator on this site handles those cases, producing downloadable PNG files for gradient backgrounds where a CSS value is not sufficient.
CSS gradients are applied as background images, not background colors, which means they can be layered. The background property accepts multiple comma-separated values, and each value is rendered in stacking order. A gradient can sit behind a semi-transparent image, a gradient can layer over another gradient, and a gradient can combine with a background color in the fallback layer.
Combining a linear gradient with a radial gradient on the same element creates compound lighting effects. A diagonal linear gradient defining the base color transition with a soft radial gradient positioned off-center simulating a light source on top produces a background with significantly more visual interest than either gradient alone.
For testing how generated gradient CSS interacts with other styles and HTML content, the Live Content Previewer lets you combine your gradient CSS with markup in a live environment. Once the full stylesheet is ready, the CSS Minifier handles compression for production.
linear-gradient() transitions colors along a straight line in a defined direction. radial-gradient() transitions colors outward from a center point in a circular or elliptical shape. Both accept multiple color stops and support the same color formats.
A conic gradient transitions colors around a center point angularly, like slices of a pie. Unlike linear and radial gradients that use distance-based color stops, conic gradients use angle-based stops measured in degrees. They are useful for pie charts, color wheel displays, segmented circular elements, and certain geometric background patterns.
Place two color stops at the same position. For example, linear-gradient(red 50%, blue 50%) creates a sharp line between red and blue at the 50% mark with no transition between them. This technique produces stripes, split backgrounds, and segmented effects without any image assets.
CSS gradients themselves are not directly animatable with transitions because the browser does not interpolate between gradient values. The common workaround is to animate the background-position of a larger gradient, animate opacity on a pseudo-element with a different gradient, or use CSS custom properties (variables) with Houdini if browser support allows. For most practical animation needs, these approaches produce satisfactory results.
Yes. Linear and radial gradients have had full cross-browser support for many years. Conic gradients are supported in all modern browsers including Chrome, Firefox, Safari, and Edge. No vendor prefixes are required for any gradient type in current browser versions.