Home Tools Blog About

CSS Gradient Generator

In short

Design a linear, radial or conic CSS gradient by dragging color stops on a bar. Copy the CSS with a solid fallback color, a Tailwind class or the HTML, or download the gradient as a PNG image.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Drag a handle to move a stop. Click the bar to add one. Use the arrow keys on a focused handle for 1% steps.

Color stops

The gradient and the PNG are made in your browser; nothing is uploaded.
🛡
Private by designYour files and text stay in this tab
⚡
Runs in your browserNo waiting for a server
💧
No watermarksClean output you can use
🆓
FreeNo account needed

How to Use CSS Gradient Generator

CSS Gradient Generator · free online tool · All Tools Verse
The CSS Gradient Generator tool, as it looks in your browser.
  1. Pick a type. Linear, radial or conic, with Repeating for stripes. Or start from a preset or Random.
  2. Set the stops. Drag the handles on the bar, click the bar to add a stop, or type a color and a position. Hex, rgb(), hsl() and color names all work.
  3. Fine-tune the shape. Set the angle for linear, shape, size and center for radial, or the start angle for conic.
  4. Copy or download. Copy the CSS, the Tailwind class or the HTML, or download a PNG in one of five sizes.

Example: the default indigo to cyan gradient

When the tool opens, it shows a 135 degree gradient from #4f46e5 to #06b6d4. The CSS it gives you is:

.gradient-box {
  background-color: #2b7edd;
  background-image: linear-gradient(135deg, #4f46e5, #06b6d4);
}

The background-color line is the fallback: the average of the stop colors, used if the gradient cannot be drawn. The first and last stops sit at the ends, so their positions are left out, which is the CSS default. The Tailwind class for the same gradient is bg-[linear-gradient(135deg,#4f46e5,#06b6d4)]. Tailwind reads the underscores as spaces.

Switch to Radial, choose Ellipse and closest-side, and move the center to 30% and 40%. The output becomes radial-gradient(ellipse closest-side at 30% 40%, #4f46e5, #06b6d4).

CSS gradient syntax at a glance

These are presets from the tool with the exact value it produces:

Type CSS value What you see
Linear linear-gradient(45deg, #ff7e5f, #feb47b) Colors change along a straight line at 45 degrees
Linear, 3 stops linear-gradient(180deg, #0f2027, #203a43 50%, #2c5364) Top to bottom, with a middle color at 50%
Radial radial-gradient(circle at 0% 0%, #a78bfa, #4f46e5 50%, #0f172a) A circle growing from the top left corner
Conic conic-gradient(#ff0000, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000) Colors swept around the center, like a color wheel
Repeating linear repeating-linear-gradient(45deg, #4f46e5, #4f46e5 10%, #c7d2fe 10%, #c7d2fe 20%) Hard-edged diagonal stripes that repeat every 20%

Direction keywords and angles: we drew each pair below side by side in a 400 by 200 pixel box in Chromium and compared the pixels.

Keyword Angle Result
to top 0deg Same
to right 90deg Same
to bottom (the default) 180deg Same
to left 270deg Same
to top right 45deg Different unless the box is square

“to top right” points the gradient at the corner, so on a wide box its angle is not 45 degrees. Use the keyword when you want the corners to get the end colors, and an angle when you want a fixed slope.

How it works

  • The preview and the stop bar use the same CSS value you copy, so what you see is what you get.
  • Stops are sorted by position. Two stops at the same position make a hard edge instead of a blend.
  • The PNG is drawn on a canvas in your browser. For linear gradients the line length follows the CSS rule (width × |sin angle| + height × |cos angle|). Radial sizes and conic start angles are converted the same way, and repeating stops are copied across the whole image. In our checks in Chromium, the PNG matched the browser’s own CSS rendering at every sampled pixel, apart from the edges of hard stripes.
  • New stops added on the bar take the color found at that point of the gradient.

Limits

  • The tool reads hex, rgb(), hsl() and about 30 common color names. Other CSS colors, such as oklch(), are accepted when your browser supports them, but the fallback color then uses the first stop.
  • Conic PNGs need a browser that can draw conic gradients on a canvas. If yours cannot, the tool says so and the CSS still works.
  • It does not add color-space keywords like “in oklch”. Add them by hand if you want that kind of blending.
  • Up to 16 color stops.

Frequently asked questions

How do I make a gradient go from left to right?

Use an angle of 90deg, or the keyword “to right”; they draw the same gradient. 0deg goes upward and 180deg, the default, goes downward.

Why does “to top right” look different from 45deg?

The keyword aims the gradient at the corner, so its angle depends on the box shape. On a 400 by 200 box it is clearly different from 45deg; on a square box they match.

How do I make hard stripes instead of a smooth blend?

Put two stops at the same position, such as #4f46e5 10% and #c7d2fe 10%, then tick Repeating. The Diagonal stripes preset shows the pattern: it repeats every 20%.

Do CSS gradients work in all browsers?

Linear and radial gradients work in every current browser without prefixes. Conic gradients have worked in Chrome, Edge, Firefox and Safari since late 2020. The fallback color covers anything older.

How do I use the gradient in Tailwind CSS?

Copy the Tailwind class and add it to your element, for example class=”h-40 bg-[linear-gradient(135deg,#4f46e5,#06b6d4)]”. The arbitrary value works in Tailwind 3 and 4, with underscores standing in for spaces.

Keep going

Related Tools

All Developer tools →

CSS Animation Generator →

Creates CSS animations from 20 presets or your own keyframes, with a live preview,…

CSS Aspect Ratio →

Generate CSS aspect-ratio with padding-top fallback, object-fit options, 16+ presets, decimal input. Live preview.…

CSS Beautifier →

Formats CSS with clean indentation or minifies it to the smallest safe size. Choose…

CSS Border Radius Generator →

Visual CSS border-radius with elliptical mode, 6 unit types (px/%/em/rem/vw/vh), 8 shape presets, live…

CSS Clip Path Generator →

Builds clip-path shapes visually: drag the points of a polygon, resize a circle or…

CSS Columns Generator →

Generate CSS multi-column layout with column-count or column-width, gap, rule, fill, span, break-inside. Live…

CSS Cursor Generator →

Browse 34 CSS cursors organized by category, with custom URL cursor builder. Live hover…

CSS Filter Generator →

Generate CSS filter with 10 functions including drop-shadow, backdrop-filter mode, 8 preset combinations. Live…

CSS Flexbox Generator →

A visual flexbox builder: set the container, click any item to change how it…

CSS Glassmorphism Generator →

Builds frosted glass CSS with backdrop-filter. Preview it on four test backgrounds, see an…

CSS Grid Generator →

Visual CSS Grid builder with grid-template-areas, auto-fit + minmax responsive tracks, per-item spans. 6…

CSS Media Query Generator →

Build @media queries: width, dark mode, reduced-motion, hover, pointer, orientation, print. Free, offline, client-side,…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: