CSS Gradient Generator
Design smooth CSS linear and radial gradients with angle controls, color stops, and modern OKLCH interpolation locally in your browser.
About this tool
Every slider or color change rebuilds the CSS linear-gradient() or radial-gradient() declaration string and applies it directly to the preview stage style. Prototype hero backgrounds and card accents quickly.
How to use the CSS gradient generator
- Choose Linear or Radial for the type of gradient.
- Pick the start and end colours with the colour pickers.
- Set the angle for a linear gradient, or use Reverse to swap the two colours.
- Tick in oklch to blend the colours in the OKLCH space, which often avoids muddy midpoints.
- Copy the CSS rule and paste it into the background property of a block.
What a CSS gradient is
A CSS gradient is an image made by the browser from colour stops. A linear gradient runs in a straight line at an angle, while a radial gradient spreads outward from a centre point. Gradients are lighter than image files, scale to any size, and can be changed by editing the colour values.
Blending in OKLCH keeps the brightness of the middle of the gradient more even than a plain RGB blend, which often avoids the grey patch that some colour pairs produce.
A worked example
A linear gradient at 135 degrees from blue to a lighter violet runs diagonally from the top left to the bottom right. Reversing it turns the blue into the start of the gradient instead, so the lighter tone appears in the top left corner.
- Create a hero background that moves from a brand colour to a light tint.
- Make a subtle radial glow behind a card.
Who uses a gradient generator
- Front-end developers building backgrounds without an image file.
- Designers testing brand colour combinations.
- Marketing teams creating banners and social headers in CSS.
- Students learning how CSS colour functions work.
- Anyone who wants a smooth background in a few clicks.
Tips and common mistakes
- Very old browsers may not support every colour space. Provide a plain colour fallback before the gradient.
- Check the text on a gradient at its lightest and darkest points, using the WCAG Contrast Checker.
- Large gradients can cost a little more to draw on weak devices. Keep them simple for long pages.
- A gradient in a page background should not distract from content. Use soft colours for body areas.
- The CSS is generated in your browser, and nothing is sent to our server.
Frequently asked questions
Related browser tools
Aspect Ratio Calculator
Calculate simplified aspect ratios via GCD, scale pixel dimensions proportionally, and copy CSS aspect-ratio rules in your browser.
Box Shadow Generator
Design soft CSS box shadows visually with X/Y offset, blur, spread, opacity, and inset controls locally in your browser.
Color Converter
Convert colors between HEX, RGB, HSL, and CSS OKLCH with a live swatch preview and RGB sliders locally in your browser.