Colour · gradientCSS gradient generator

Build a linear, radial or conic gradient by dragging colour stops and copy ready CSS. With a text readability check and a hint when the transition turns muddy.

Runs in your browser
01Builder02Readability03Recipes04About05Questions06Related
01

Builder

move the stops — the CSS follows at once
Preview · linear
drag the centre

Colour stops

2 of ∞ · at least 2click the bar to add a stop; drag a marker or move it with the arrow keys
Stop 1 of 2selected on the bar
hsl(227 100% 71%)oklch(67.1% 0.173 270)
Settings
Type
Angle
Interpolationhow the browser blends colours between stops
sRGB is the default and works everywhere. Opposite colours blend through grey in it.
Export
background: #6c8cff;
background: linear-gradient(135deg, #6c8cff 0%, #b18cff 100%);
Presets · 12
Warm
Cool
Neutral
Take colours from the palette generator
02

Text readability

WCAG contrast along the whole gradient, not at one point
Gradient sweep · 0–100 %1 % step · threshold 4.5:1
Sample text
threshold 4.5:112:11:1
2.6:1 · 100 %
0 %25 %50 %75 %100 %
Parts below the threshold are highlighted in red. For radial and conic gradients the sweep runs from the centre outwards and around.
Text on top · WCAG 2.1
Worst point
2.6 : 1at 100 %
Worst point: 2.6:1 at 100 % — the text is unreadable.
AAA (7:1): fails
Open in the contrast checker →
03

Recipes

ready code and a live example — in your colours
04

About gradients

A CSS gradient is a smooth transition between colours. You set two things: a direction (an angle, a centre or a sector) and colour stops — colours with optional positions. The browser works out the rest, and how it blends the colours decides whether the transition comes out clean or muddy.

Three types

Basics
linear · radial · conic
A linear gradient carries colour along a line, a radial one outwards from the centre, a conic one around the centre. Conic gradients are used for charts and colour wheels.

Colour stops

Stops
#f00 0%, #00f 100%
Each stop is a colour and a position. Two stops at the same position make a hard edge — that is how stripes and two-tone backgrounds are made without images.

The dead grey zone

Problem
blue → yellow
With ordinary blending, a transition between opposite colours sinks into muddy grey. It is not a browser bug but a property of sRGB.

OKLCH to the rescue

Fix
in oklch
Adding in oklch makes the browser blend in a perceptual space: the transition stays clean and even in lightness.

Text on top

Accessibility
worst point
Text on a gradient reads differently in different places: where the background lightens, contrast may drop below the norm. Check the whole length, not one colour.

Banding

Print and screen
dithering
Large smooth transitions show visible steps. A light noise over the gradient or more contrasting colours help.
05

Frequently asked

Put the linear-gradient function into the background property with a direction and colours: background: linear-gradient(135deg, #6c8cff, #b18cff). The angle sets the direction, colours are separated by commas, and percentage positions are optional — without them the browser spreads the colours evenly. The builder writes the code for you: move the stops on the bar and copy ready CSS, a rule with a fallback or a Tailwind class.

Updated

«» added to favorites