FormatterHQ

CSS Gradient Generator

Build linear, radial and conic gradients by dragging color stops on a bar, then copy clean CSS, a Tailwind arbitrary class or an SVG version.

Loading tool…
Ready.

How to use the CSS Gradient Generator

  1. Choose a Type (Linear, Radial or Conic), or click one of the ten Presets under the code panel to start from a finished gradient.
  2. Click the color-stop bar to add a stop, drag the markers to move them, and set each stop's color, Position % and Opacity % in the stop editor. Remove deletes the selected stop.
  3. Adjust the Angle, or the Shape and Center X / Y % for radial and conic gradients. Tick Repeating gradient for stripes, or try Random and Reverse.
  4. To edit a gradient you already have, open Import existing CSS gradient, paste it and press Load gradient.
  5. Pick the CSS, Tailwind or SVG tab and use Copy or Download above the code.

A CSS gradient generator with draggable color stops

This CSS gradient generator lets you design linear-gradient(), radial-gradient() and conic-gradient() backgrounds visually. You place color stops on a bar, watch the result on a large preview drawn over a checkerboard (so transparent areas are obvious), and get a rule you can paste straight into a stylesheet.

There is no fixed limit on the number of stops. Each stop has its own color, position and opacity, so the same editor handles soft two-color fades, fades to transparent, hard-edged stripes and multi-color backgrounds.

Example output

The default Ocean preset produces this rule:

.gradient {
  background: #0ea5e9;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
}

The first background line is a solid fallback using the first stop's color. A browser that cannot parse the gradient keeps that color; every other browser overrides it with the second line. The Tailwind tab turns the same value into an arbitrary-value class, with spaces replaced by underscores:

bg-[linear-gradient(135deg,#0ea5e9_0%,#6366f1_100%)]

For linear gradients an SVG tab appears as well. It holds an 800×400 SVG with a <linearGradient> that follows your angle and stops, which is useful in design tools or anywhere a CSS background is not an option.

Options explained

Linear, radial and conic

  • Linear blends colors along a straight line. The Angle follows CSS conventions: 0deg points up, 90deg to the right and 180deg down.
  • Radial spreads outward from a center point as an Ellipse (which follows the box proportions) or a Circle. Center X % and Center Y % move the origin, giving output such as radial-gradient(circle at 50% 50%, …).
  • Conic sweeps colors around the center, like a color wheel or a pie chart. Here the slider is labeled Start angle and becomes from 0deg at 50% 50%.

Stop opacity

A stop with an opacity below 100% is written as rgba(). A scrim that darkens the bottom of a hero image, for example, comes out as linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%). Layer it above a photo with a second background and white text stays legible.

Repeating gradients and hard stops

Two stops at the same position create a hard edge instead of a blend. Combine that with Repeating gradient and you get stripes: the Candy stripes preset outputs repeating-linear-gradient(45deg, #f472b6 0%, #f472b6 5%, #fdf2f8 5%, #fdf2f8 10%). For dots, grids and checkerboards, the CSS background pattern generator builds ready-made patterns from gradients.

Editing stops quickly

  • Click anywhere on the bar to add a stop. Its color is interpolated from the neighboring stops, so the gradient does not jump when it appears.
  • Focus a marker and use the arrow keys to move it by 1% (hold Shift for 10%), or press Delete to remove it. A gradient always keeps at least two stops.
  • Reverse mirrors every stop position, which is faster than dragging each marker when you want the colors the other way round.
  • The importer understands directions such as to right, angles in deg, turn or rad, and hex, rgb(), hsl() and basic named colors.

Tips and common mistakes

  • Muddy middles. Blending two opposite hues, such as orange and blue, can pass through a dull gray. Add a brighter stop in the middle to keep the transition vivid.
  • Using background-color. A gradient is an image, so it belongs in background or background-image. background-color: linear-gradient(…) is invalid and ignored.
  • Banding on large areas. A very subtle gradient stretched over a full screen can show visible steps. Widen the color difference slightly or add an intermediate stop.
  • Text contrast. Text on a gradient has to be readable over both its lightest and its darkest part. Test both end colors with the color contrast checker.

If a brand color arrives as RGB or HSL, convert it with the color converter before typing it into a stop. To fill headings rather than boxes, the CSS gradient text generator adds the background-clip: text rules for you.

Privacy

The gradient is calculated and rendered entirely in your browser. Nothing you design or import is uploaded to a server.

Frequently asked questions

How do I make a gradient fade to transparent?
Select the last stop and set its Opacity % to 0. The generator writes that stop as rgba() with an alpha of 0 in the same color, so the content underneath shows through without a gray tint in between.
Why is the SVG tab missing for my gradient?
SVG export is only offered for linear gradients. Radial gradients in SVG use a different coordinate model, and SVG has no native conic gradient, so the tab is hidden for those types.
Do conic gradients work in all browsers?
conic-gradient() is supported in current versions of Chrome, Edge, Firefox and Safari. Very old browsers ignore the declaration, which is why the generated CSS starts with a solid background line as a fallback.
Can I animate a CSS gradient?
Browsers do not smoothly transition between two different gradient images. Common workarounds are animating background-position on an oversized gradient, fading a second gradient layer in with opacity, or registering the stop colors as custom properties with @property and animating those.
How do I use the Tailwind output?
Paste the class into an element's class attribute. It uses Tailwind's arbitrary-value syntax, where underscores stand for spaces, so it needs a Tailwind version with arbitrary values (v3 or later).

Last updated October 3, 2026

Related tools

CSS Gradient Text Generator Fill headings with a colour gradient using background-clip: text. Pick two or three colours and an angle and copy cross-browser CSS. CSS Animation Generator Generate CSS @keyframes animations — fade, slide, zoom, bounce, pulse, shake, spin and more — with duration, delay, easing and loop controls. CSS Background Pattern Generator Generate repeating CSS background patterns — stripes, polka dots, checkerboard, grid, zigzag and more — using only gradients, no images. CSS Border Radius Generator Set border-radius per corner in px or %, or shape organic blobs with the 8-value "fancy" border-radius syntax. Live preview and copyable CSS. CSS Box Shadow Generator Design layered CSS box-shadows with sliders for offset, blur, spread, colour and opacity. Supports inset shadows, presets and a Tailwind class. CSS Button Generator Design a CSS button with colours, gradient, padding, radius, border, shadow and hover/focus states, then copy clean HTML and CSS. CSS Grid Generator Build CSS grid layouts: fixed or responsive auto-fit columns, row sizes, gaps and alignment, with a live grid preview and copyable CSS + HTML. CSS Loader & Spinner Generator Create lightweight pure-CSS loading spinners — ring, dual ring, bouncing dots, bars and pulse — with custom colour, size and speed. CSS Pretty Print Opinionated CSS pretty print with Prettier: normalises case, leading zeros, quotes and semicolons so a team's stylesheets look alike. CSS Scrollbar Generator Style scrollbars for Chrome, Edge and Safari (::-webkit-scrollbar) and Firefox (scrollbar-color) at once, with a scrollable live preview. CSS Text Shadow Generator Generate CSS text-shadow effects — soft shadows, hard 3D offsets and neon glows — with live preview on your own text, then copy the CSS. CSS to LESS Converter Convert CSS to LESS online. Rules sharing a selector are nested automatically.