Skip to content
YouNeed Tools
Free VPN

CSS Gradient Generator

Pick the gradient type, set the colours, their positions and the angle, and copy the ready-to-paste background CSS.

Type
Colour stops
0%
50%
100%

The first line is a solid fallback colour. Every current browser supports these gradients without prefixes.

Made on your device.

Worked example

For a warm hero banner, choose Linear, set the angle to 135° (top-left to bottom-right), make the first stop coral #ff7e5f at 0% and the second peach #feb47b at 100%. The code is background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);, with background: #ff7e5f; on the line before as a fallback.

Gradient recipes

Ocean
linear-gradient(90deg, #2193b0 0%, #6dd5ed 100%)
Spotlight
radial-gradient(circle at center, #ffffff 0%, #1e293b 70%)
Colour wheel
conic-gradient(from 0deg at center, #ff0000 0%, #00ff00 33.3%, #0000ff 66.7%, #ff0000 100%)
Hard stripes
linear-gradient(90deg, #0f766e 0%, #0f766e 50%, #f59e0b 50%, #f59e0b 100%)

Tips for good gradients

  • Neighbouring hues (blue to teal, orange to pink) blend more cleanly than opposite ones, which can turn grey in the middle.
  • Keep text readable: test the lightest and darkest parts behind your text with the contrast checker.
  • Stack gradients with commas to layer a subtle overlay on a photo: linear-gradient(rgb(0 0 0 / 0.4), transparent), url(photo.jpg).
  • Use repeating-linear-gradient for stripes and patterns without images.

Accessibility and performance

Gradients are drawn by the browser, so they cost no download and stay sharp at any screen size, unlike a background image. If text sits on top, check contrast at both ends of the blend, not just the middle, and give the element a solid background colour first so the text stays readable if the gradient fails to load or the page is printed. People who turn on high-contrast or forced-colours modes in Windows may not see background gradients at all, which is another reason never to put important information only in a gradient. For subtle backgrounds, keep the two colours close in lightness; a large lightness jump draws the eye away from the content.

Related tools

Sources

Checked on November 26, 2026:

Frequently asked questions

How do I make a gradient in CSS?
Use a gradient function as a background: background: linear-gradient(90deg, #2193b0, #6dd5ed). The angle sets the direction (0deg points up, 90deg to the right) and the colors are the stops.
What is the difference between linear, radial and conic?
Linear blends along a straight line, radial spreads out from a point in a circle or ellipse, and conic sweeps around a point like the hands of a clock, which is useful for pie charts and colour wheels.
How do I make hard edges instead of a blend?
Give two neighbouring stops the same position: #0f766e 50%, #f59e0b 50% switches color sharply at the halfway point. That is how CSS stripes and flags are drawn.
Do I need -webkit- prefixes?
No. Every current browser supports linear-gradient, radial-gradient and conic-gradient without prefixes. The solid background line before the gradient is a fallback for very old browsers and for print.
Can I put a gradient on text?
Yes: set the gradient as the background, then background-clip: text and color: transparent on the element. Check the contrast of the lightest part against the page.
Why does my gradient look banded?
Long blends between similar colors can show visible steps on some screens. Adding a middle stop, or blending in OKLCH (linear-gradient(in oklch, …)) in modern browsers, gives a smoother result.

Last updated: 2026-11-26