When to use it
Use this tool to design a CSS gradient visually and copy ready-to-use code. Gradients are popular for hero sections, buttons, cards, banners and backgrounds. Seeing the result live is much faster than adjusting numbers in a code editor and refreshing the page.
How to use it
- Start from a preset, such as Ocean, Sunset, Mint, Peach, Night or Rainbow, or build your own.
- Choose the Type: Linear, Radial or Conic.
- Set the Angle for linear and conic gradients.
- Under Colors, pick each color and drag its position slider. Use Add color for more stops.
- Watch the large preview, then click Copy CSS.
Worked example
The default Ocean preset blends sky blue into deep blue at 135 degrees. The CSS is:
background: #0ea5e9;
background: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
Paste it into a CSS rule, such as .hero, to give a page header a diagonal blue background. To make the blue appear sooner, drag the second color’s position from 100% to 70%. The code updates to #1d4ed8 70%.
For a soft spotlight effect, switch to Radial, choose a light color in the middle and a darker one at the edge.
Color stops explained
Each color has a position from 0% to 100% along the gradient. Two colors at 0% and 100% blend evenly across the whole area. Moving them closer together makes the change sharper. If two stops share the same position, you get a hard line instead of a blend, which is a neat way to make stripes or split backgrounds.
Using it in a page
Add the copied lines to any CSS rule, such as a header, a button or the body. The gradient fills the element’s background and adapts to any size, so it looks right on phones and large screens alike. Pair it with a matching solid color for borders or hover states.
Tips
- Keep it subtle. Two similar colors usually look more professional than strong contrasts.
- Check text contrast. Make sure text stays readable over the lightest and darkest parts.
- Use angles for direction. 90deg runs left to right, 180deg top to bottom.
- Reuse the code. Store it as a CSS variable to use the same gradient across your site.
Common mistakes
- Using too many colors. More than three or four stops can look muddy.
- Forgetting the fallback. It costs nothing and protects older browsers.
- Putting gradients on large text blocks. Busy backgrounds make long text hard to read.