CSS Gradient Generator
Choose two to six colors, pick linear or radial, and this tool writes the matching CSS gradient value while showing a live preview swatch. Linear gradients get an angle slider from 0 to 360 degrees; radial gradients render as a centered circle. When it looks right, copy a ready to paste background declaration. Nothing is uploaded, so it all happens in your browser.
How to generate a CSS gradient
- Click each color swatch to set a stop, and use + Add or remove to keep between two and six colors.
- Choose Linear or Radial with the Type toggle.
- For a linear gradient, drag the Angle slider to aim the direction from 0 to 360 degrees.
- Watch the preview panel update as you change colors, type or angle.
- Click Copy CSS to grab the full background declaration for your stylesheet.
Examples
Two-color linear gradient at 90deg
#ff0000 and #0000ff, linear, 90deg
linear-gradient(90deg, #ff0000 0%, #0000ff 100%)
Three-color linear gradient at 45deg
#ff0000, #00ff00, #0000ff, linear, 45deg
linear-gradient(45deg, #ff0000 0%, #00ff00 50%, #0000ff 100%)
Radial gradient with named colors (via API)
stops red and blue, radial
radial-gradient(circle, red 0%, blue 100%)
Frequently asked questions
What CSS does this generate?
A standard linear-gradient or radial-gradient value, wrapped in a background declaration when you copy. You can paste it into a background or background-image property in any modern stylesheet.
How are the stop positions decided?
Stops are spread evenly across the gradient. Two colors sit at 0 percent and 100 percent, three land at 0, 50 and 100 percent, and four fall at 0, 33.33, 66.67 and 100 percent. The percentages are computed automatically.
How many colors can I use?
Between two and six. The + Add button stops at six stops and the remove control is disabled once you are down to two, since a gradient needs at least two colors to blend.
What does the angle control?
For a linear gradient the angle sets the direction of the blend. 0deg points to the top, 90deg to the right, 180deg to the bottom and 270deg to the left. Radial gradients ignore the angle and render as a circle from the center.
Can I use named colors or transparency?
The color swatches in the tool produce six digit hex codes. The underlying engine accepts any valid CSS color verbatim, including names like red, rgb and rgba values, and transparent, which is available through the API.
Why does the copied code start with background:?
The Copy CSS button gives you a complete declaration, background: <gradient>;, so you can drop it straight into a rule. Delete the background: prefix if you only want the raw gradient value.
Does the preview match what I will get in production?
Yes. The preview panel uses the exact same generated string as its background, so the swatch you see is the gradient your CSS will render in a browser.
Can I set custom stop percentages in the UI?
Not in the visual tool, which always distributes stops evenly. The API accepts an optional pos value from 0 to 100 on each stop if you need uneven spacing.
Is anything sent to a server?
No. The gradient string is built locally in your browser, so your color choices never leave your device.
Learn more
- Linear vs radial CSS gradients
How linear and radial gradients differ, what the angle and stop positions mean, and when to reach for each in real layouts.
Related tools
Color Mixer
Mix two hex colors online and get the blend. Set the mix ratio with a slider to find the perfect in-between color, then copy the hex result.
Color Shades Generator
Generate tints and shades from one hex color online. Pick a base color and get lighter and darker steps toward white and black, ready to copy.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.
Binary to Decimal
Convert binary to decimal online. Paste any binary number, with or without spaces, and get the exact base-10 value instantly. Runs in your browser.