Free Gradient Generator

Build a smooth gradient — add colour stops, set the angle, pick linear or radial — then copy the CSS or download a PNG.

Honest limits — read first: Gradients blend in sRGB by default, so blends between opposite colours (blue to yellow) can go grey in the middle. This page's OKLCH toggle is on by default — it keeps the middle vivid, with a plain sRGB line above it as a fallback for older browsers. The PNG download is a flat 1200×675 sRGB snapshot, not a scalable gradient, and it cannot carry the OKLCH interpolation. Sampled values are sRGB; a Display P3 photo's hex is a clipped approximation. CMYK is an estimate, not print-accurate.

Your gradient

Type

sRGB blends through grey — OKLCH travels around the hue wheel. With this on, the copied CSS has a plain sRGB line first (older browsers use it) and the OKLCH line second.

Colour stops (2–5)
Gradient from a photo

Upload a photo and its three most common colours become your gradient stops. The image is read in your browser via canvas — nothing is sent or stored.

Presets

CSS code

background: linear-gradient(90deg, #FF6B6B 0%, #4ECDC4 100%);

Paste the CSS as a background value on any element — a hero, a button, a card. The PNG is the same gradient as a flat sRGB image (canvas gradients cannot carry OKLCH interpolation). The share link encodes the full gradient — type, angle, stops and the OKLCH setting.

Contrast across the gradient

Checked at five points — both ends, the middle and the two quarter-points — against white and black text. A gradient only passes if the text colour passes at every point you actually place text on.

The problem: your gradient goes grey in the middle

Every developer has lived this one: you pick a beautiful blue and a beautiful yellow, write the gradient, and the middle comes out a muddy grey-brown that belongs in no design system. It is the single most asked-about gradient problem online, and the reason is colour maths — browsers blend in sRGB by default, and the straight line between opposite colours passes through grey. The second frustration is simpler: people know the two colours they want but not the CSS syntax, the angle numbers, or how to add a third stop in the right place. They want to see the blend live, nudge it until it looks right, and copy one line of code that pastes straight into their stylesheet.

How do I make a CSS gradient for free?

Pick two or more colours here, set each stop's position, choose linear or radial and the angle, then click Copy CSS and paste the line into your stylesheet as a background value. It is free, with no signup, and the preview updates live as you change anything. If the middle of your blend looks grey, add a bright colour stop in the middle — that is the quick fix for the muddy-middle problem — or pick colours closer together on the colour wheel.

A CSS gradient is a smooth transition between two or more colours, drawn by the browser itself — no image file is needed. A linear gradient blends along a straight line at an angle (90deg runs left to right); a radial gradient blends outward from a centre point. Each colour stop pairs a colour with a position from 0% to 100% along the blend.

How to build a gradient in 3 steps

STEP 1

Pick your colours

Start from a preset or set two stops yourself. Add up to 5 stops for richer blends.

STEP 2

Set direction

Choose linear or radial, then set the angle for linear gradients — 90° runs left to right, 180° top to bottom.

STEP 3

Copy or download

Copy the CSS into your stylesheet, or download the gradient as a 1200×675 PNG for slides and social posts.

Why does my gradient look grey or muddy in the middle?

Browsers interpolate gradients in sRGB by default, and the straight line between two opposite colours in RGB space passes through grey — blue (#0000FF) to yellow (#FFFF00) has a midpoint of roughly #808080, literally grey. The fixes, in order: add a middle stop with a bright colour between them, which forces the blend through that colour instead of grey; pick colours closer in hue; or interpolate in OKLCH with linear-gradient(in oklch to right, …), which follows the perceptual colour wheel and stays vivid (supported in current Chrome, Edge, Firefox and Safari — older browsers ignore the line, so keep a plain sRGB gradient above it as a fallback). A second grey culprit is transparency: the keyword transparent is transparent black, so fading to it passes through grey — fade to the same colour at zero alpha instead, like rgba(0, 0, 0, 0) for black.

Linear, radial or conic — which one?

Linear gradients suit backgrounds, buttons and overlays: a 90° or 135° diagonal is the classic hero background. Radial gradients suit glows, spotlights and vignettes — a light centre fading outward. Conic gradients sweep around a centre point like a pie chart or colour wheel, and suit dials, wheels and pie-style fills. Keep it to two or three colours: gradients with many unrelated colours look busy. For text over a gradient, check the contrast at five points across it — the checker above does exactly that — not its average; run the exact pair through the Color Contrast Checker before you ship it.

How the OKLCH toggle fixes the grey middle

With the toggle on, the copied CSS is two lines: a plain sRGB gradient first, then the same gradient with in oklch after the gradient name. Browsers that understand OKLCH use the second line and blend around the hue wheel, so blue to yellow stays vivid instead of passing through grey; older browsers ignore the line they do not understand and fall back to the sRGB one. That is why the toggle is on by default here — the fallback makes it safe to leave on. One caveat: the PNG download is drawn on a canvas, which blends in sRGB only, so a downloaded PNG will not show the OKLCH improvement — use the CSS on a website to get it.

How do I fix gradient banding?

Banding is the visible stepping on a long, subtle gradient. Add more intermediate stops in a perceptual space (OKLCH) so each step is smaller, then layer a faint noise or dither texture over the gradient — a low-opacity noise pattern breaks up the visible bands without changing the colours. This tool has no built-in noise control: if you see banding, add a middle stop here, then add the noise layer in your own CSS or image editor.

Gradient from a photo

Upload a photo above and the tool reads its three most common colours (by counting colour buckets on a small canvas copy, in your browser) and sets them as gradient stops. It is a quick start, not a palette-AI: the colours are the most frequent ones in the photo, so a busy photo can give you its background rather than its subject. Nudge the stops by hand after importing.

FAQ

How do I make a CSS gradient?

Pick linear, radial or conic; set two or more colour stops with positions (0–100%); set the angle (linear) or shape and centre (radial); copy the CSS, for example background: linear-gradient(90deg, #FF6B6B 0%, #4ECDC4 100%);.

Why does my gradient look grey/muddy in the middle?

Browsers interpolate in sRGB by default, and the straight line between far-apart hues passes through grey — blue to yellow midpoints at about #808080. Fix it by interpolating in oklch (this page's toggle, on by default), adding a middle stop (for example pink between purple and orange), or picking neighbouring hues.

What is the difference between linear, radial and conic gradients?

Linear blends along a straight line or angle; radial radiates from a centre point (circle or ellipse); conic sweeps around a centre point like a pie chart or colour wheel.

How do I fix gradient banding?

Add more intermediate stops in a perceptual space (OKLCH), then layer a faint noise or dither texture over the gradient — a low-opacity noise pattern breaks up visible bands without changing the colours. This tool has no built-in noise control, so add the noise layer in your own CSS or image editor.

Is this gradient generator really free?

Yes. Build and export as many gradients as you like — no signup, no watermark, no upload. Everything runs in your browser.

What does the OKLCH toggle do?

It changes the copied CSS to blend in OKLCH instead of sRGB, so the middle of the blend stays vivid instead of going grey. The CSS has a plain sRGB line first as a fallback for older browsers, then the OKLCH line. The PNG download stays sRGB, because canvas gradients cannot carry OKLCH interpolation.

How many colour stops can I add?

Up to 5 stops here — enough for almost every real design. Two or three colours is the sweet spot; more than that usually looks busy.

Should I use the CSS or the PNG download?

Use the CSS for websites: it stays sharp at any size and adds no image weight. Use the PNG for slides, documents and social posts where CSS is not available.

Can I make a transparent gradient?

Yes in the CSS by hand — use an 8-digit hex or rgba() value in a stop. This tool's stops are solid colours; fade to the same colour at zero alpha rather than the transparent keyword, or the middle goes grey.

What angle should a hero gradient use?

90° (left to right) and 135° (diagonal) are the most common. 180° runs top to bottom and suits overlays on photos. For conic gradients the angle is the starting point of the sweep.

How do I use a gradient on a button?

Paste the CSS as the button's background value. Keep the text contrast at 4.5:1 against the lightest part of the gradient — the five-point checker above shows the ratio at both ends, the middle and the quarter-points.

Can I animate a gradient?

Not directly in CSS, but you can animate the background position of a large gradient. This tool exports a static gradient only.

How do I make a gradient from a photo?

Upload a photo in the “Gradient from a photo” box and its three most common colours become your gradient stops. It is read in your browser via canvas — nothing is sent or stored. Nudge the stops by hand after importing, since a busy photo can give you its background rather than its subject.

How do I check text contrast on a gradient?

Check it at five points across the gradient — the endpoints, the midpoint and the two quarter-points — not at one average. This page's checker does that against white and black text, with the WCAG AA verdict per point. A gradient only passes if the text colour passes at every point you place text on.

Related questions

What angle should a hero gradient use? 90° (left to right) and 135° (diagonal) are the most common. 180° runs top to bottom and suits overlays on photos. For conic gradients the angle is the starting point of the sweep.

How do I use a gradient on a button? Paste the CSS as the button's background value. Keep the text contrast at 4.5:1 against the lightest part of the gradient.

Why does my gradient look different in Figma? Figma and browsers interpolate colour differently. Trust the browser preview here — it is what your visitors will see.

Can I animate a gradient? Not directly in CSS, but you can animate the background position of a large gradient. This tool exports a static gradient only.