CSS Gradient Generator
Create a two-color linear-gradient CSS declaration.
Set the options above to generate a CSS declaration. No text input is required.
Your result will appear here…
How to use CSS Gradient Generator
- Set the Angle (degrees).
- Choose the First color and the Second color.
- Run Generate CSS and copy the resulting line.
Example
Input / settings:
Angle 90, first color #0f172a, second color #38bdf8
Output:
background: linear-gradient(90deg, #0f172a, #38bdf8);
Chrome accepts this value as a valid background. The same colors at 180deg would run from top to bottom.
When to use
- Create a background for a button, banner or card.
- Compare two brand colors at different angles.
- Get a starting value to refine by hand.
Overview
CSS Gradient Generator writes a single declaration, background: linear-gradient(…), from an angle and two colors picked with native color pickers. The angle is in degrees: 0deg points up, 90deg points right and 180deg points down. It makes two-stop linear gradients only, with no color positions, radial gradients or conic gradients.
Supported input
angle and two colors
Output details
CSS background declaration
Common mistakes
- The declaration uses the background shorthand. After other background rules it resets every background property, such as background-size and background-repeat, to its initial value. Use background-image to keep them.
- Only two colors and one angle are available. There are no stop positions, color hints or repeating gradients.
- An angle of 0 points up, not right. The same colors at 90 run from left to right.
- Colors come from color pickers as six-digit hexadecimal values, so transparency, named colors and rgb() values cannot be chosen here.
- The angle is written as entered and is not rounded: 12.5 produces 12.5deg.
Practical tips
- Add background-size or background-repeat after the generated line, not before it.
- Try the same two colors at 90 and 180 degrees to choose between a horizontal and a vertical blend.
Privacy and security
This tool runs entirely in your browser. Your input is never uploaded to our servers. The declaration is assembled locally from three values, and nothing is uploaded or stored.
References
Frequently asked questions
Why does a gradient at 0 degrees go upward?
In CSS, 0deg points to the top and angles increase clockwise, so 90deg runs left to right and 180deg runs top to bottom.
Can I add more than two colors?
No. The generator writes exactly two color stops. Add more stops by editing the generated value.
Is the generated value valid CSS?
With colors chosen in the pickers it is. The example value above is accepted by Chrome's CSS support check.