CSS Gradient Generator
Create beautiful CSS gradients with live preview
Examples
Default two-stop linear gradient
Type: Linear · Angle: 90° · Stops: #667eea @0%, #764ba2 @100%background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);The boot configuration. A horizontal indigo-to-purple brand background that matches the most common 'Tailwind / Stripe-style' purple hero used across marketing pages.
Three-stop diagonal hero
Type: Linear · Angle: 45° · Stops: #4facfe @0%, #00f2fe @50%, #43e97b @100%background: linear-gradient(45deg, #4facfe 0%, #00f2fe 50%, #43e97b 100%);Adding a mid stop at exactly 50% gives the gradient a clean blue→cyan→green transition. The middle stop is positioned with zero ambiguity (the parser sees `50%`, not a fractional position).
Radial sunset
Type: Radial · Stops: #fa709a @0%, #fee140 @100%background: radial-gradient(circle, #fa709a 0%, #fee140 100%);Switching to Radial without an angle drops the angle token and emits `circle` as the radial shape. The generator always re-sorts stops by position before emitting, so the input order of the stops doesn't leak into the output.
About this tool
A CSS gradient is a background-image value painted by the browser itself — no asset, no round-trip, fully responsive — and CSS supports two linear and radial variants with up to any number of colour stops along a 0–100% axis. The generator exposes the levers you actually need: type (linear | radial), the linear angle (0–360°), and a dynamic list of colour stops with per-stop colour picker and position slider. Two stops minimum, more on demand, and stops are always emitted in sorted order so the output is identical regardless of how you added them.
Six presets cover the common cases: a '90deg indigo→purple' brand background, a 135° pink→coral hero, a 45° blue→cyan tech accent, a 180° green→mint fresh-feel, and two radial gradients (pink→yellow, teal→indigo). Each preset loads with a single click and updates the live preview plus the emitted CSS in one render — so A/B-ing palettes is a matter of clicking and copying. The output is `background: <gradient>;` and the Copy CSS button writes exactly that string to your clipboard.
Stops can be added, recoloured, repositioned, and removed (down to a 2-stop minimum). The preview panel shows a hero-sized block plus a thin 16-px bar — the bar reads the same gradient at a different aspect ratio, useful for verifying that a stop at, say, 60% does not vanish entirely when applied to a header strip. All computation, comparison and rendering happens in your browser; the gradient string is the only thing that leaves the page.
How to use
Choose a type
Click Linear or Radial. Linear uses the angle slider (0–360°); radial renders as a circle centred on the element — no angle, just colour stops along the radial axis.
Set the angle and stops
For Linear, drag the Angle slider. Each stop has its own colour picker and 0–100% position slider. Add stops with + Add; remove with the trash icon (minimum 2 stops).
Watch the live preview
The hero block and the bar at the bottom update on every change. Use the bar preview to check that none of your colour stops disappear at low aspect ratios.
Copy the CSS
Click the Copy button on the CSS Code block. The generated `background: linear-gradient(…);` rule is ready to drop into a stylesheet, a Tailwind arbitrary value (`bg-[linear-gradient(…)]`) or a styled-components template.
Use a preset as a starting point
Click any of the six preset cards to load its type, angle and stops. From there, change individual stops to nudge the palette in your direction.
Use cases
Hero and pricing-page backgrounds
Use a 90° or 135° two-stop gradient as a low-cost brand section background — usually lighter-weight than a background-image, scales to any breakpoint, and themable via CSS custom properties.
Status badges and tags
Stack two complementary colours at 0% and 100% and apply the gradient with `background-clip: text` for gradient-filled text — useful for 'Beta', 'New', and pricing tier labels.
Progress bars and loaders
A radial gradient as a background plus an opaque inner pill gives the loader a subtle glow that doesn't require an animated SVG. Static, cheap, themable.
Color exploration before locking in a palette
Click through the six presets, tweak a stop or two, and produce a candidate palette quickly. Once a palette sticks, convert the colours to design tokens and use the gradient as the marketing page background.
Common mistakes
Mistake:Typing colour positions outside the 0–100% range.
Fix:Gradients silently clamp positions to [0, 100] — a stop at 120% is rendered at 100% and produces a hard edge at the end. Stay within 0–100% (or use percent and let the browser clamp).
Mistake:Assuming stops with the same position are blended linearly.
Fix:Two stops at the same percentage render a hard line, not a blend. Move one of them off the other to make a smoother transition, or use distinct positions for distinct colour blocks.
Mistake:Animating `background-image` between two gradient strings.
Fix:CSS animations cannot interpolate `background-image` — gradients are images and the browser cannot tween between them. Animate `background-position` of a single static gradient instead, or use opacity transitions between two stacked elements.
Mistake:Forgetting `background-size` when applying a gradient as a pattern.
Fix:By default the gradient stretches to the element's box. Repeating patterns need an explicit `background-size`, `background-repeat`, and the right gradient type. For seamless tiling use `repeating-linear-gradient` / `repeating-radial-gradient` rather than scaling.
Mistake:Reading 'angle 0' as 'right-to-left' and shipping the wrong direction.
Fix:CSS angles are measured clockwise from the top of the element (0° = 'up', 90° = 'right'). Mental model is clockwise from 12 o'clock — the slider's tiny compass (`0° ↑, 90° →, 180° ↓, 270° ←`) is the ground truth.
Frequently asked questions
Related guides
References & standards
Related tools
Color Blindness Simulator
Simulate color blindness on palettes and images. Compare protanopia, deuteranopia, tritanopia, and more side-by-side.
Color Contrast Checker
Advanced WCAG accessibility compliance checker with color blindness simulation, multiple text sizes, and comprehensive analysis features.
Color Converter
Convert colors between multiple formats (HEX, RGB, HSL, HSV, CMYK, LAB) with color blindness simulation, named colors, and batch processing
Color Extractor
Extract colors from uploaded images by hovering over pixels to get precise color values.
Color Generator
Generate color palettes, analyze colors, and create gradients with this comprehensive color tool.
Color Mixer
Blend two colors together by any ratio. See intermediate steps and copy the result in HEX, RGB, or HSL.