Build a CSS gradient background
A gradient blends one colour smoothly into another. It is a light-weight way to make a banner, a hero section or a button look finished without using an image file. Pick two colours, set the angle and the preview updates as you go; then copy the background line of CSS. Below you will find colour pairs that work well together, how the angle is measured, and how to avoid banding and repeating stripes.
How to make a CSS gradient
- Choose your first and second colors.
- Adjust the angle with the slider.
- Watch the live preview update.
- Click Copy CSS and paste it into your project.
Features
- Live gradient preview.
- Adjustable angle from 0 to 360 degrees.
- Ready-to-paste CSS output.
- Private and browser-based.
- Free with no sign-up.
Using the CSS output
Copy the generated line into the style of any element, for example:
background: linear-gradient(135deg, #4F46E5, #06B6D4);
- Angle: 0° runs from bottom to top, 90° from left to right, and 180° from top to bottom. Diagonals such as 135° look natural for cards and buttons.
- Colours close in hue make smooth, professional gradients; very different colours can look harsh.
- Keep text readable. Check that text has enough contrast on both ends of the gradient.
- Add a plain
background-colorbefore the gradient as a fallback for very old browsers.
Colour pairs that work well
| Mood | Colour 1 | Colour 2 | Good for |
|---|---|---|---|
| Sunset | #FF7E5F | #FEB47B | Food, travel and lifestyle banners |
| Ocean | #2193B0 | #6DD5ED | Calm sections, health and finance sites |
| Royal | #4E54C8 | #8F94FB | Tech products, app landing pages |
| Fresh | #11998E | #38EF7D | Success messages, eco and farming topics |
| Bold | #F12711 | #F5AF19 | Sale banners, YouTube thumbnails |
More ways to use a gradient
- Darken a photo behind text. Put a see-through gradient over an image so white headings stay readable:
background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.1)), url(photo.jpg); - Thumbnails and social posts. A gradient background with a short headline is a quick, clean design for YouTube thumbnails and Instagram posts.
- Buttons. A slight gradient between two close shades makes a flat button look clickable without heavy effects.
- Circular glow. Change
linear-gradient(135deg, ...)toradial-gradient(circle, ...)in the copied CSS for a spotlight effect from the centre. - WordPress. Add a rule such as
.my-gradient { background: ... }in your theme's Additional CSS, then type my-gradient in any block's Additional CSS class(es) box to reuse it on several pages.
Your privacy
The gradient is previewed and the CSS is written by your own browser. Nothing is uploaded or stored.
Frequently asked questions
What CSS does it produce?
It generates a standard linear-gradient background rule you can use anywhere.
Can I use more than two colors?
This tool focuses on clean two-color gradients; you can extend the copied code manually.
Is anything uploaded?
No, everything runs in your browser.
What does the angle in a CSS gradient mean?
It sets the direction of the colour change. 90 degrees goes left to right and 180 degrees goes top to bottom.
Can I use the gradient on text or borders?
The generated value works as a background. Other uses need extra CSS properties, such as background-clip for text.
Why does my page background gradient repeat in stripes?
When the gradient is on the body and the page is short, the browser repeats it. Add min-height: 100vh to the body, or background-attachment: fixed, so one gradient covers the whole screen.
Why do I see bands instead of a smooth blend?
Very large areas with two close colours can show visible steps on some screens. Pick colours a little further apart, or add a middle colour stop in the copied CSS to smooth the blend.