CSS Gradient Generator
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free CSS gradient generator. Pick colors, positions and an angle for linear, radial or conic gradients, see a live preview and copy clean CSS.
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the CSS gradient generator
- Pick a type: linear (a straight blend from one side to another), radial (a circle spreading out from the centre) or conic (colors sweeping round a point, like a color wheel).
- Set the angle with the slider for linear and conic gradients. 0° goes from bottom to top, 90° from left to right, 180° from top to bottom.
- Choose two colors and their positions, from 0% to 100%. Tick "Add a third color" for a three-color blend.
- Watch the preview update as you change anything.
- Copy the CSS and paste it into your stylesheet.
The CSS gradient generator writes two lines: a plain background color first, as a fallback, and then the gradient. Nothing is uploaded, and there's no sign-up.
The CSS it writes
For a diagonal blend from tan to dark brown, the output looks like this:
background: #c8a27a;
background: linear-gradient(135deg, #c8a27a 0%, #3b2a1e 100%);
The first line is a solid color. Every browser in use today supports gradients, but the solid line costs nothing and means something sensible still shows if the gradient line is ever removed, overridden or mistyped. It also gives tools such as screen readers and contrast checkers a color to work with. Then the second line, which browsers do understand, replaces it.
Gradients are background images in CSS, so you can also use them with background-image, layer them over photos, or use them on borders and text with a few extra lines.
Linear, radial and conic gradients
Linear gradients blend along a straight line. They're the most common kind: subtle top-to-bottom shading on buttons and cards, bold diagonal banners, and the "fade to transparent" over an image that makes white text readable.
Radial gradients start at a point and spread outwards. The CSS gradient generator makes them circular and centred: radial-gradient(circle at center, …). They're good for spotlights, soft glows behind a product, and vignettes that darken the edges of a section.
Conic gradients sweep colors around a centre point, starting at the angle you choose. They're used for pie charts and progress rings made purely in CSS, color wheels, and some striking abstract backgrounds. Give the last stop the same color as the first for a seamless loop.
Understanding angles
In CSS, gradient angles work like a compass, with 0° pointing up:
| Angle | Direction |
|---|---|
| 0° | Bottom to top |
| 45° | Bottom left to top right |
| 90° | Left to right |
| 135° | Top left to bottom right |
| 180° | Top to bottom |
| 270° | Right to left |
You can also write directions as words, such as to right or to bottom right. The generator uses degrees because they're exact: to bottom right changes its angle with the shape of the box, while 135deg doesn't.
Color stops and positions
Each color has a position, called a stop. Between two stops, the browser blends smoothly. A few useful patterns:
- 0% and 100% spread the blend across the whole element.
- Stops close together, such as 45% and 55%, make a short, sharp transition.
- Two stops at the same position, such as 50% and 50%, make a hard edge with no blend: half one color, half the other. That's how stripes and split backgrounds are made.
- A third color in the middle adds a highlight or a band, such as a lighter tone at 50% for a glossy look.
The generator sorts stops by position, so you can type them in any order.
Making gradients look good
Keep colors related. Gradients between colors next to each other on the color wheel (blue to purple, orange to pink) usually look smooth. Gradients between opposite colors (red to green, blue to orange) can create a muddy grey band in the middle. If that happens, add a third color in the middle that bridges the two.
Go subtle for interfaces. A button that shifts only slightly in lightness looks modern and polished. Bold rainbow blends are better kept for hero sections and illustrations.
Use your brand colors. Start with your main brand color and a lighter or darker version of it. The color shades generator gives you a full scale to choose from, and the image color picker can pull colors from your logo or a photo.
Check readability. If text sits on a gradient, check the contrast at both ends with the color contrast checker. Text that's readable on the dark end can disappear on the light end.
Watch for banding. On long, subtle gradients across large areas, some screens show visible steps instead of a smooth blend. Using colors that differ a little more, or adding a very faint texture, helps.
Gradients over images
A common use of the CSS gradient generator is making text readable on photos. Layer a gradient over the image in the same background declaration:
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.6) 100%), url(hero.jpg) center / cover;
The gradient is see-through at the top and darkens towards the bottom, where the headline sits. Generate the gradient here, then change its colors to rgba values with transparency. The HEX to RGB converter helps you turn a HEX color into the RGB numbers you need.
Gradients and performance
CSS gradients are drawn by the browser, so there's no image file to download. They're tiny in your stylesheet, scale perfectly to any screen size, and stay sharp on high-resolution displays. Replacing a gradient image with CSS saves a request and keeps pages light, which helps load times and Core Web Vitals. If your stylesheet is getting long, the CSS minifier shrinks it for production.
Pairing gradients with shadows
Gradients and shadows together give cards and buttons depth: a slight top-to-bottom gradient suggests light from above, and a soft shadow underneath lifts the element off the page. The box shadow generator writes matching shadow CSS.
Browser support
Linear and radial gradients have worked in every major browser for over a decade, without prefixes. Conic gradients work in all current versions of Chrome, Edge, Firefox and Safari. The CSS gradient generator writes the standard syntax only: the old -webkit- prefixed forms aren't needed any more.
Text with a gradient
A popular effect is filling headline text with a gradient. Generate the gradient here, then use it like this:
.headline {
background: linear-gradient(90deg, #c8a27a 0%, #7a4a2a 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
The gradient is clipped to the shape of the letters. Keep the colors dark enough to read against the page, and keep a solid fallback color in mind for anyone using high-contrast modes, where backgrounds may be removed.
A worked example
A bakery is building a new landing page. Its brand colors are a warm tan (#c8a27a) and a deep brown (#3b2a1e), and the designer wants a hero section that feels warm and rich, with white text on top.
She opens the CSS gradient generator, keeps Linear, and sets the angle to 135° so the blend runs from top left to bottom right. Color 1 is the tan at 0%, color 2 the brown at 100%. The preview looks good, but the white headline in the top left, over the tan, would be hard to read.
She ticks "Add a third color", picks a mid-brown, #7a4a2a, and sets it at 35%, so the darker tones reach the top half sooner. She checks white on #7a4a2a in the contrast checker: about 7.4:1, comfortably readable. She copies the CSS:
background: #c8a27a;
background: linear-gradient(135deg, #c8a27a 0%, #7a4a2a 35%, #3b2a1e 100%);
The hero section now uses no image at all, loads instantly, and matches the brand.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.
Frequently asked questions
How do I make a gradient in CSS?
Use background: linear-gradient(angle, color1 position, color2 position);. This CSS gradient generator builds it for you: pick the colors, positions and angle, and copy the code.
What's the difference between linear and radial gradients?
A linear gradient blends along a straight line in one direction. A radial gradient blends outwards from a centre point in a circle.
Why does the CSS include two background lines?
The first is a solid color, as a fallback for anything that doesn't draw the gradient. The second is the gradient itself. Browsers that understand the second line use it.
Is this CSS gradient generator free?
Yes. It's free with no sign-up, and the CSS you copy is yours to use anywhere.
How do I make a gradient with a hard edge?
Give two colors the same position, such as 50% and 50%. The browser switches from one to the other with no blend.
Do CSS gradients work in all browsers?
Linear and radial gradients work in every modern browser, and conic gradients work in all current versions of Chrome, Edge, Firefox and Safari.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.