Embed this tool on your site
About this tool
CSS gradients power hero backgrounds, button fills and overlays, but the syntax is easy to forget. The CSS Gradient Generator builds a two-color gradient with a live preview. Choose Linear or Radial, pick Color 1 and Color 2, and use the Midpoint slider to set how far Color 1 stays solid before it blends into Color 2 — the output always lists three stops: Color 1 at 0%, Color 1 at the midpoint and Color 2 at 100%. Linear gradients take their direction from the Angle slider; radial gradients are a circle centred at 50% 50%. The CSS box holds a background-image declaration ready to copy. The angle in the output currently stops at 100deg even though the slider goes to 360, so edit the degree value in your stylesheet if you need a different direction.
Why use it
Linear and Radial in One Tool: Switch the Type dropdown and the same two colors render as a directional fade or a centred circular glow.
Midpoint Control: The Midpoint slider holds Color 1 solid up to a chosen percentage, which makes off-centre fades easy.
Live Preview: The preview panel repaints on every slider or color change, so you see the gradient before copying it.
Background-Image Ready: The output is a complete background-image declaration that pastes straight into a CSS rule or custom property.
No Prefixes Needed: The generated linear-gradient() and radial-gradient() syntax works unprefixed in all current browsers.
How to use
- Select Linear or Radial from the Type dropdown
- For linear gradients, drag the Angle slider to set the direction (the output currently caps at 100deg)
- Pick Color 1 and Color 2 with the color pickers
- Drag the Midpoint slider to set where Color 1 starts blending into Color 2
- Click Copy CSS to grab the background-image declaration
When it helps
- When designing a hero section background that transitions between two brand colors
- When you need a two-tone background where one color dominates before the blend starts
- When building a radial spotlight effect on a dark card or feature highlight section
- When you want a quick starting gradient to paste into a stylesheet and refine by hand
Examples
InputLinear, Angle 90, Midpoint 0, Color 1 #f6d365, Color 2 #fda085
Expected resultbackground-image: linear-gradient(90deg, #f6d365 0%, #f6d365 0%, #fda085 100%);
InputRadial, Midpoint 20, Color 1 #4f46e5, Color 2 #1e1b4b
Expected resultbackground-image: radial-gradient(circle at 50% 50%, #4f46e5 0%, #4f46e5 20%, #1e1b4b 100%);
03Default settings (Angle slider at 120)
InputLinear, Angle 120, Midpoint 45, Color 1 #3b82f6, Color 2 #f59e0b
Expected resultbackground-image: linear-gradient(100deg, #3b82f6 0%, #3b82f6 45%, #f59e0b 100%);
Tips
- Use 135deg (top-left to bottom-right) for a natural diagonal that reads left-to-right in most layouts — it follows the same direction as reading flow
- For smoother transitions between saturated hues, add a third stop between them by editing the copied value.
- Combine two or three stacked radial-gradient() backgrounds with rgba transparency to fake a soft mesh gradient in pure CSS
- Use rgba(0,0,0,0) rather than the keyword transparent for stop colors to avoid gray desaturation artifacts during the fade in some browsers
- Set Midpoint to 0 for an even blend across the whole element; raise it to keep Color 1 solid over more of the area before the fade starts.
Frequently Asked Questions
What is the difference between linear, radial, and conic gradients?⌄
Linear gradients transition colors along a straight line at a given angle. Radial gradients expand outward from a center point in a circle or ellipse. Conic gradients sweep colors around a center point like clock hands, making them ideal for pie charts and color wheels. This generator makes linear and radial gradients.
Can I add more than two color stops?⌄
Not in this tool. It always writes three stops — Color 1 at 0%, Color 1 at the midpoint and Color 2 at 100%. CSS accepts any number of comma-separated stops, so add more by editing the copied value.
Can I make a transparent-to-color gradient overlay?⌄
Yes. Set the first stop to rgba(0,0,0,0) or a transparent value and the last stop to your target opaque color. This creates a fade-in effect commonly used as a scrim over hero images to ensure text legibility at the bottom. The color pickers here only produce opaque hex colors, so edit the copied value to add transparency.
Why does my linear gradient angle look wrong?⌄
CSS gradient angles are measured clockwise from the top of the element (0deg points up, 90deg points right). This differs from standard mathematical angles (counterclockwise from the right). Using the to keyword syntax like to bottom right is often more intuitive than degree values.
How do conic gradients differ from radial?⌄
Radial gradients expand color outward from a center point as concentric rings. Conic gradients rotate color around a center point as wedge-shaped segments, similar to a pie chart. Both support the at keyword to position the center.
Can I animate a CSS gradient between two states?⌄
Gradients are not directly animatable with transitions because they are background images, not color values. A workaround is to animate background-position on an oversized gradient, or use CSS custom properties with @property to register them as animatable color values.
Are CSS gradients supported in all modern browsers?⌄
Linear and radial gradients have near-universal support. Conic gradients are supported in all major modern browsers including Chrome, Firefox, Safari 12.1+, and Edge. Vendor prefixes are no longer needed for any gradient type in current browser versions.
How do I create a mesh gradient with pure CSS?⌄
Stack multiple radial-gradient() values in a single background property separated by commas. Position each radial at different coordinates with different colors and high blur. The overlapping translucent circles blend to approximate a soft mesh gradient without SVG or images.
Why does the angle stop at 100deg?⌄
The Angle slider runs from 0 to 360, but the current output clamps the value to 100deg. For directions beyond that, such as 135deg or 180deg, change the number in the copied CSS.
Glossary
- Linear Gradient
- A CSS gradient that transitions colors along a straight line at a specified angle or direction, such as linear-gradient(to right, #ff0000, #0000ff).
- Radial Gradient
- A CSS gradient that emanates outward from a center point as a circle or ellipse, transitioning through specified color stops from inside to outside.
- Conic Gradient
- A CSS gradient where color transitions sweep around a center point like clock hands, making it suited for pie charts, color wheels, and angular patterns.
- Color Stop
- An individual color value at a specific position within a gradient, defined as a color plus an optional length or percentage that determines where the color peaks.
- Gradient Angle
- The direction of a linear gradient specified in degrees, measured clockwise from the top. 0deg is upward, 90deg is rightward, and 180deg is downward.
- Mesh Gradient
- A complex multi-point gradient effect where colors blend from several anchor points simultaneously. Approximated in CSS by layering multiple semi-transparent radial gradients.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities