Skip to content

CSS gradient generator

Pick a type, drag the colour stops and copy the gradient as Tailwind CSS 4 classes like bg-linear-135 from-[#0ea5e9] to-[#6366f1], as plain CSS, or as an @theme token. Both blend in OKLab, as Tailwind 4 does, so what you copy looks like the preview.

Start from
Colour stopsClick the bar to add · drag to move

Ship the page this week, not next quarter

Readable text on your gradient is the real test. Switch to Plain to see the gradient alone.

Get started
bg-linear-135 from-[#0ea5e9] to-[#6366f1]

Tailwind 4 blends gradients in OKLab by default; the CSS does the same, so both look alike.

Heroes and banners you can install now

6 of 91 free, no account. All of them in UI Pro.

  • Hero (hero-01)01

    Hero

    hero-01 · Free. Journey-planner hero: from/to card with leave-at tabs, a day-out photo card and four quick-task tiles.

    Open hero-01
  • Call to action (call-to-action-01)02

    Call to action

    call-to-action-01 · Free. Closing panel with a very large centred title, three pill actions (call, mail, book) and the founders' faces.

    Open call-to-action-01
  • 03

    All free blocks

    Every one with a live preview, filtered to the ones you can use for free first.

    See them all

Questions

How do I make a gradient in CSS?

Use background-image with linear-gradient(), radial-gradient() or conic-gradient(): a direction, then two or more colour stops, each with an optional position. For example background-image: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%). Add "in oklab" after the direction to blend the colours the way Tailwind 4 does, which avoids the grey middle you often get in sRGB.

How do I make a gradient in Tailwind CSS 4?

Combine a direction class with from-, via- and to- colours: bg-linear-to-r from-sky-500 to-indigo-500. Tailwind 4 renamed bg-gradient-to-r to bg-linear-to-r, added any angle (bg-linear-45), radial (bg-radial) and conic (bg-conic) gradients, and positions like from-10% and to-90%. Hex colours go in square brackets: from-[#0ea5e9].

What does "blend in OKLab" mean?

It is the colour space the browser mixes the stops in. sRGB, the old default, runs two saturated colours through a dull grey in the middle (blue to yellow is the classic case). OKLab keeps the middle bright, which is why Tailwind 4 uses it for every gradient. Add /oklch or /srgb to the direction class to change it: bg-linear-to-r/oklch.

How do I use more than three colours in a Tailwind gradient?

Tailwind has one from, one via and one to, so for four or more stops write the gradient as an arbitrary value: bg-[linear-gradient(90deg_in_oklab,#f00_0%,#ff0_33%,#0f0_66%,#00f_100%)]. The generator does this for you, or put the gradient in @theme as --background-image-brand and use bg-brand.

How do I put text on a gradient and keep it readable?

Keep the gradient within one lightness band behind the text: all light colours under dark text, or all dark under white. Switch the preview to "As a hero" to check. A gradient from light to dark behind centred text nearly always fails contrast somewhere.

Is it free?

Yes. No sign-up, and nothing leaves your browser. The address bar holds your gradient, so you can share the link.

UI Pro

Build your next site from finished blocks

Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.

blocks
1401
page templates
55
website themes
29
The About page template from UI Pro, built from its blocks.

This card is a UI Pro block: Rooilijn (call-to-action-07).