CSS Free, no sign-up

CSS gradient generator

Choose a gradient type, change the colors and their positions — the background updates instantly and ready-made CSS for background appears below.

Result
Ready-made CSS
.element {
  background: #2563eb;
  background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
}

How to use it

  1. Pick a type: linear (along a line), radial (circles from the center) or conic (rotating around the center).
  2. Set the angle or position: for linear, 90deg runs left to right and 180deg runs top to bottom.
  3. Edit the color stops: each one has a color and a position in percent. Use “+ Add” for up to 6 stops.
  4. Click “Copy” and paste the code into your stylesheet.

How it works

A gradient is an image, not a color

In CSS a gradient is an <image>, so it goes into background or background-image, not background-color. The generator also writes a plain color first as a fallback in case the gradient is not rendered.

Angle and direction

linear-gradient(90deg, …) runs from left to right. Instead of an angle you can use keywords: to right, to bottom right. 0deg points up, 180deg points down.

background: linear-gradient(to right, #2563eb, #7c3aed);

Color stops

Each color can be followed by a position: #f00 0%, #00f 100%. When two stops share the same position the transition becomes a hard edge — that is how stripes are drawn.

background: linear-gradient(90deg, #2563eb 50%, #7c3aed 50%);

radial and conic

radial-gradient(circle at center, …) spreads from the center outward, while conic-gradient(from 0deg, …) sweeps around the center — handy for pie charts and color wheels. The repeating- prefix repeats the pattern.

FAQ

How do I make gradient text?

Set the gradient as background, then add background-clip: text and color: transparent — the text is painted with the gradient.

Why doesn't background-color: linear-gradient(...) work?

Because a gradient is an image, not a color. Use background or background-image.

Can a gradient be animated?

Not directly. The usual tricks are animating background-position on an enlarged background-size, or registering a color custom property with @property.

Is it supported in browsers?

linear-gradient and radial-gradient work in every modern browser, and conic-gradient has been supported by all major browsers since 2020. Vendor prefixes (-webkit-) are no longer needed.

This topic in the HTML & CSS course

More CSS tools

Flexbox generator and playground Try flex properties on a container and its items: direction, alignment, gaps and ready-made CSS. CSS Grid generator Set columns and rows, gaps and alignment, then copy the ready-made grid code. CSS box-shadow generator Pick offset, blur, color and layers for a shadow, then copy the ready-made box-shadow code. Cubic-bezier generator Drag the control points of an easing curve and copy the ready-made CSS transition. SVG animation generator Pick a shape and an effect — get inline SVG and CSS keyframes ready to paste. CSS specificity calculator Type selectors to see their (a,b,c) weight, a color-coded breakdown and which rule wins. CSS box model visualizer See content, padding, border and margin as a DevTools-style diagram and copy the CSS. CSS transform generator Move, rotate, scale and skew an element, see its original position and copy the code. CSS clamp() calculator Enter min and max font size and viewport width — get a ready clamp() for fluid typography. Color contrast checker (WCAG) Check text and background contrast against WCAG AA and AAA, and fix a failing pair of colors. CSS clip-path generator Polygons, bevels, arrows and circles: drag control points on the live canvas and copy ready-made CSS. CSS glassmorphism generator Frosted glass effect: backdrop-filter blur, saturation, border highlight and clean CSS. CSS border-radius (Blob) generator Organic shapes and 8-value border-radius: tune horizontal and vertical corner radii. CSS Stacking Context & z-index Visualizer Why z-index: 9999 fails! Explore CSS Stacking Contexts in interactive 3D exploded layers with transform, opacity and isolation triggers. CSS aspect-ratio & object-fit Generator Eliminate squished images & CLS layout jumps: live aspect-ratio proportions and interactive object-position focal point. CSS Filters Studio & Generator Photo effects without design tools: blur, contrast, hue-rotate, sepia, and trending Instagram-style presets. OKLCH Color Picker & Palette Generator Perceptually uniform brightness & vibrant Display P3 colors: OKLCH picker, design system scales, and fallbacks. CSS Scroll-driven Animations Generator Scroll-linked animations without JavaScript: animation-timeline scroll() & view(), reading progress bar & reveal on scroll. CSS Container Queries (@container) Generator Beyond viewport media queries: components adapt directly to their parent container width. Live resizer & @container rules.
WhatsApp