Quick Answer
- Open the free CSS Gradient Generator — no sign-up needed.
- Choose a gradient type: Linear, Radial, or Conic.
- Pick at least two color stops and set each position (0–100%).
- Adjust the angle (linear/conic) or shape and size (radial).
- Copy the generated CSS and paste it into your stylesheet.
Generate CSS Gradients with Live Preview — Free
Design linear, radial, and conic gradients with a live preview. Add up to 10 color stops, copy the ready-to-use CSS, and download a .css file — all in your browser.
Open CSS Gradient Generator →CSS gradients are one of the most impactful design techniques available to web developers — a two-line property that replaces a gradient image, saves an HTTP request, and scales perfectly to any screen size. Yet choosing the right type, getting the angle right, and knowing where to position each color stop requires real-time visual feedback that no static documentation or AI chat can provide.
This guide covers all three CSS gradient types, how to read and customise the generated code, and practical patterns you can drop straight into a project — with a free browser-based tool that lets you experiment in real time without touching a text editor.
Advertisement
The six CSS gradient functions
CSS defines three base gradient types. Each can be prefixed with repeating- to tile the pattern, giving six functions in total:
| Function | Direction control | Typical use |
|---|---|---|
| linear-gradient() | Angle (0–360°) | Banners, page sections, button fills |
| radial-gradient() | Shape + size | Spotlights, card glows, circular overlays |
| conic-gradient() | From angle | Pie charts, colour wheels, spinner loaders |
| repeating-linear-gradient() | Angle | Striped backgrounds, zebra rows |
| repeating-radial-gradient() | Shape | Bullseye, ripple effects |
| repeating-conic-gradient() | From angle | Angular tiles, fan patterns |
Tip: Gradients are values of the background or background-image property — not a separate CSS property. You can layer multiple gradients by comma-separating them in a single background declaration.
Linear, radial, and conic — how each works
Linear gradient
Colors transition along a straight line at a given angle. 0deg goes bottom to top; 90deg goes left to right; 45deg goes diagonally. The tool's angle slider gives you real-time visual feedback so you can dial in the exact direction without guessing.
/* 45° diagonal — left-bottom to right-top */
background: linear-gradient(45deg, #ff6b6b 0%, #4ecdc4 100%);
/* Top to bottom with a midpoint stop */
background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);Radial gradient
Colors radiate outward from a central point. The tool exposes two radial-specific options: shape (circle or ellipse) and size (how far the gradient extends — closest-side, closest-corner, farthest-side, or farthest-corner). Farthest-corner (the browser default) fills the entire element; closest-side creates a tighter glow.
/* Circular spotlight effect */
background: radial-gradient(circle farthest-corner at center, #feca57 0%, #ff6b6b 100%);
/* Elliptical, clipped to nearest side */
background: radial-gradient(ellipse closest-side at center, #54a0ff 0%, #5f27cd 100%);Conic gradient
Colors rotate around a center point — think of the hands of a clock sweeping through hues. This makes conic gradients uniquely suited for pie charts, color wheels, and spinner animations. The from angle sets where the gradient begins its sweep.
/* Three-segment pie: 33.3% each */
background: conic-gradient(from 0deg, #ff6b6b 0% 33%, #feca57 33% 66%, #54a0ff 66% 100%);
/* Smooth colour wheel */
background: conic-gradient(from 0deg, red, yellow, lime, cyan, blue, magenta, red);Step-by-step: create a gradient in the tool
Open the CSS Gradient Generator
Go to the CSS Gradient Generator — no account required. The tool runs entirely in your browser; nothing you configure is sent to a server.
Select a gradient type
Click Linear, Radial, or Conic. The control panel updates immediately to show the relevant options — angle slider for linear, shape/size selectors for radial, from-angle for conic.
Configure your color stops
Each stop has a color picker, a hex input field, and a position field (0–100%). The tool starts with two stops at 0% and 100%. Use "Add Stop" to insert up to eight more. Click "Random" to generate a harmonious palette instantly if you need inspiration.
Adjust direction, shape, and repeating
Drag the angle slider (linear/conic) or choose a shape and size (radial). Toggle Repeating to switch between a single-pass gradient and a tiling pattern — the live preview updates in real time so you can see the difference immediately.
Copy or download the CSS
The Generated CSS panel shows two code blocks: the raw background value and a complete .gradient { } class. Click Copy to grab the value, or Download to save a gradient.css file. Paste the value into any background or background-image property in your stylesheet.
Color stops and positioning
Each color stop is a color value and an optional position. The position (expressed as a percentage of the gradient line) controls how abruptly or gradually the colors transition. Leave out positions and the browser spaces them evenly; set them explicitly to build precise bands and hard edges.
Even spacing (auto)
linear-gradient(90deg, red, yellow, blue)Browser places stops at 0%, 50%, 100%.
Explicit positions
linear-gradient(90deg, red 0%, yellow 20%, blue 100%)Yellow appears early — red-to-yellow transition is fast.
Hard edge (color band)
linear-gradient(90deg, red 0% 50%, blue 50% 100%)Identical start/end position = no blend.
Midpoint hint
linear-gradient(90deg, red, 20%, blue)The bare percentage shifts the midpoint of the transition.
Tip: The accessibility badge next to each color stop in the tool shows its WCAG contrast ratio against white. Aim for 4.5:1 (AA pass) on any stop where you plan to overlay text.
Repeating gradients
Toggling "Repeating" in the tool prepends repeating- to whichever function is active. The browser tiles the color stops from the last stop back to the first, creating a seamless pattern. The key to useful repeating gradients is keeping the stops short — a 0%–20% band repeats five times across the element.
/* Diagonal candy stripes */
background: repeating-linear-gradient(
45deg,
#ff6b6b 0%,
#ff6b6b 10%,
#fff 10%,
#fff 20%
);
/* Bullseye rings */
background: repeating-radial-gradient(
circle at center,
#4ecdc4 0%,
#4ecdc4 10%,
#fff 10%,
#fff 20%
);Note: Repeating gradients can introduce visible seams on sub-pixel boundaries in some browsers. If you see a hairline gap at the repeat point, add a tiny overlap (e.g., end the last stop at 20.1% instead of exactly 20%).
Practical use cases
🖼️
Hero section background
A subtle linear gradient from a brand colour to white (or transparent) gives depth to page headers without relying on a large background image.
🔲
Image overlay
Layer a linear-gradient(to top, rgba(0,0,0,0.6), transparent) on a card image using background-image to add a scrim for legible text without hiding the photo.
🔘
Button shimmer
A repeating linear gradient at 45° with a narrow transparent band creates a moving shimmer effect when animated with background-position.
🥧
Pie / donut chart
Conic gradients are the simplest way to render a static pie chart in pure CSS — no SVG, no JS library. Define each segment as a colour band at explicit degree positions.
🌐
Skeleton loading state
A repeating linear gradient animated across a placeholder div mimics the "shimmering skeleton" loading pattern used by Facebook and YouTube.
🖊️
Gradient text
Set background to a linear-gradient, add background-clip: text and -webkit-background-clip: text, then set color: transparent to apply the gradient to text characters.
Browser support
All three gradient types are fully supported in every modern browser — Chrome 26+, Firefox 16+, Safari 7+, and Edge 12+. Conic gradients were the last to ship, reaching baseline support in 2021 (Chrome 69, Safari 12.1, Firefox 83).
| Function | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| linear-gradient() | 26+ | 16+ | 7+ | 12+ |
| radial-gradient() | 26+ | 16+ | 7+ | 12+ |
| conic-gradient() | 69+ | 83+ | 12.1+ | 79+ |
| repeating-*-gradient() | 26+ | 16+ | 7+ | 12+ |
No vendor prefixes are needed for any of these functions in 2026. If you must support IE 11, linear and radial gradients require -webkit- and -ms- prefixes — conic gradients were never supported in IE.
Frequently asked questions
What is a CSS gradient?
A CSS gradient is a smooth colour transition rendered directly by the browser using the background property — no image file required. The three types are linear-gradient(), radial-gradient(), and conic-gradient(), each producing a different geometric effect.
What is the difference between a linear and a radial gradient?
A linear gradient fades colours along a straight line at a given angle — top to bottom, left to right, or any diagonal. A radial gradient radiates outward from a central point in a circular or elliptical shape, like a spotlight.
Do I need to use -webkit- prefixes for CSS gradients?
No. All modern browsers — Chrome, Firefox, Safari, and Edge — support unprefixed gradient functions. Vendor prefixes were needed before 2013 and can safely be omitted for any project targeting browsers from the last decade.
How many color stops can I add to a CSS gradient?
The CSS specification has no hard limit. The tool caps inputs at 10 stops for practical usability. In real projects, 2–5 stops produce the cleanest results; more stops tend to create muddy or visually complex transitions.
Can I use a CSS gradient as a border?
Not with border-color directly. You can achieve a gradient border using border-image: linear-gradient(...) 1 or by placing a gradient pseudo-element behind the element and using padding to reveal it. The tool generates the gradient value you need for either approach.
What is a repeating gradient and when should I use it?
A repeating gradient tiles the colour stops continuously across the element. It is ideal for decorative stripe patterns, candy-stripe borders, or bullseye effects. Enable the Repeating toggle in the tool and keep your stops short (under 25%) to get a visible tile effect.
Build your CSS gradient now — Free
Visual live preview, up to 10 color stops, linear/radial/conic types, and one-click CSS copy. No account, no watermark, no limit.
Open CSS Gradient Generator →