CSS gradient generator

A CSS gradient generator builds a background-image value that blends two or more colors, such as linear-gradient(90deg, #6366f1, #ec4899). Pick linear or radial, set the colors and angle, and copy the CSS.

Build a two-stop linear or radial gradient on a real card or button, then copy one clean background-image declaration.

How to use the generator

  1. Start from a preset or type two colors. Paste a HEX value or an rgb() color and the swatch updates when the value is valid.
  2. Choose linear or radial, set the angle for linear, and move each stop between 0% and 100%. Arrow keys nudge every number field.
  3. Switch between the card and button preview, press Reverse colors to swap the stops, then press Copy CSS.

Need starting colors? Pick a pair from real website color palettes, then paste both HEX codes here.

0deg points up and 90deg points right. Arrow keys nudge by 1deg.

Project update

Three screens are ready for review.

Your CSS

background-image: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);

Copy-ready gradient presets

Indigo dusk CTA

background-image: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);

Warm sunrise banner

background-image: linear-gradient(90deg, #f97316 10%, #facc15 100%);

Ocean spotlight card

background-image: radial-gradient(circle at center, #22d3ee 0%, #0f172a 100%);

Readable text on a gradient

A gradient changes color behind the text, so one contrast reading cannot validate the whole element. Test the lightest stop, the darkest stop and the middle of the blend where your headline or button label actually sits with the color contrast checker. If the middle fails, add a semi-transparent overlay, narrow the color range, or move the text over a flatter part of the gradient. To fill the letters themselves with a gradient, use the CSS text gradient generator. Need a repeating texture instead of a single blend? Try the CSS background pattern generator.

Study gradients on real interfaces

See how live products use gradient washes behind headlines, buttons and full-width hero sections, then recreate the effect here.

Frequently asked questions

What does the angle mean in a linear-gradient?

0deg runs bottom to top, 90deg left to right, 180deg top to bottom and 270deg right to left. Values above 360deg wrap, so 360deg matches 0deg. If you leave the angle out, CSS uses 180deg, top to bottom. The angle only applies to linear gradients; a radial gradient starts from its center point instead.

What is the difference between linear and radial gradients?

A linear gradient blends along a straight line at the angle you choose, which suits banners, buttons and section backgrounds. A radial gradient blends outward from a centre point in rings or a circle, which suits spotlights and soft glows. Both use the same two color stops here, and the stop positions tell each color where to start.

What do color stop positions do?

A stop position sets where a color is at full strength along the gradient, from 0% at the start to 100% at the end. Between two stops the colors blend evenly. Moving the first stop to 30% keeps the first color solid for the first 30% of the line, and placing both stops at the same position creates a hard edge with no blend.

How do I check whether text is readable on a gradient?

There is no single contrast measurement for a whole gradient, because the background color changes across the element. Check the lightest and darkest points behind the text, plus the midpoint where the text sits, with the contrast checker, and review every text size and state. A pair that passes on one stop does not prove the rest of the gradient is readable.

More CSS generators

Color tools

Image tools

Image & SVG tools

Typography & units

More free tools

All free tools