Free tool
CSS Gradient Generator
Build linear and radial CSS gradients with a live preview, up to eight color stops and opacity, then copy the CSS. Nothing is uploaded or stored.
Runs entirely in your browser. Nothing you type or upload is sent to our servers.
How to make a CSS gradient
- Choose Linear or Radial.
- Set the angle (linear), or the shape and center (radial).
- Pick colors, set each stop's position and opacity, and add stops if you need them.
- Copy the CSS and paste it into your stylesheet.
Worked examples
A blue to purple diagonal: a linear gradient at 135 degrees with a blue stop at 0 percent and a purple stop at 100 percent produces this line:
background: linear-gradient(135deg, #1d4ed8 0%, #9333ea 100%);A soft spotlight from the top left: a white stop at 0 percent, a half-transparent dark stop at 60 percent and a solid dark stop at 100 percent. The half-transparent stop is written with rgba() and a 0.5 alpha, the others as hex colors:
background: radial-gradient(circle at top left, #ffffff 0%, rgba(15, 23, 42, 0.5) 60%, #0f172a 100%);What the output follows
- Stops are sorted by position, and positions are percentages from 0 to 100.
- Full-opacity colors are six-digit hex; anything see-through is
rgba()with an alpha from 0 to 1. - Angles are written in degrees (0 to 360). Radial gradients are written with a shape and a center keyword.
Add depth with the CSS box shadow generator, take colors from a photo with the image color picker, or test your finished markup in the HTML viewer.
Frequently asked questions
How do I use the CSS this tool gives me?
Copy the line, for example background: linear-gradient(90deg, #ff0000 0%, #0000ff 100%);, and paste it into a rule for the element you want to fill, such as .hero { ... }. You can also paste only the part after "background:" into a stylesheet property or a design tool that accepts CSS gradient values.
What is the difference between linear and radial?
A linear gradient blends colors along a straight line, set by the angle. A radial gradient blends colors outward from a center point in a circle or an ellipse. In this tool you pick the angle for linear, and the shape and center position for radial. The color stops work the same way in both.
How do the angle numbers work?
The angle is a number of degrees from 0 to 360, written into the CSS as, for example, 135deg. Drag the slider and watch the preview: it shows the direction your browser draws for that value, which is the quickest way to find the one you want. Values such as 45, 90 and 135 are good places to start.
How many color stops can I use, and what is a stop?
You can use 2 to 8 stops. A stop is a color placed at a position from 0 to 100 percent along the gradient. The tool sorts the stops by position before writing the CSS, so the output is always in order, whichever order you add them in. Each stop has its own color, position and opacity.
How do I make part of a gradient see-through?
Lower the opacity of a stop. A stop with opacity below 100 percent is written as an rgba() color, for example rgba(255, 0, 0, 0.5). A stop at full opacity is written as a six-digit hex color. This lets you fade a color out to nothing over an image or another background.
Is my work saved or uploaded?
No. The preview and the CSS are produced in your browser, and nothing is stored or sent anywhere. Reloading the page returns it to the starting gradient, so copy the CSS before you leave if you want to keep it.
Can I pick colors from a picture?
This tool uses standard color pickers and six-digit hex values. To pull colors from a photo or screenshot, use the image color picker, copy the hex values it shows, and paste them into the color fields here. Hex codes work the same wherever you take them from.
Link to this tool
Found it useful? Copy a link for your page, newsletter or documentation.
Get new tools and guides by email
Optional. The tool above works without signing up.
More free tools
Browse all developer tools or the full list of free tools.
- CSS Box Shadow GeneratorDesign a CSS box shadow with sliders, stacked layers, inset shadows and opacity, see it live, and copy the box-shadow CSS. Runs entirely in your browser.
- chmod Calculator (Octal and Symbolic)Convert Unix file permissions between octal like 755 and symbolic like rwxr-xr-x, apply symbolic changes, and copy the chmod command. Runs in your browser.
- Password & API Key GeneratorGenerate strong random passwords and API keys with your browser's cryptographic random number generator. Nothing is sent or stored.
- JSON Formatter, Validator & MinifierValidate, pretty-print, sort and minify JSON with clear error messages that show the exact line and column. Runs in your browser, so your data stays private.
- Barcode Generator (Code 128, EAN-13, UPC-A)Create Code 128, EAN-13 and UPC-A barcodes with the check digit calculated for you, then download SVG or PNG. Input is validated and stays in your browser.
- Emoji Copy and PasteSearch about 1,900 emoji by name or keyword, browse them by category, and copy any of them with one click. The emoji you pick are never sent anywhere.