Create beautiful CSS gradient backgrounds with live preview. Pick colors, adjust the angle, copy the code — done in seconds.
Last updated:
CSS gradients replaced thousands of gradient image files when they became widely supported. A background that once required a 1px-wide PNG image (with all its HTTP request overhead) became a single line of CSS. Today, gradients are one of the most versatile tools in a front-end developer's kit — used for backgrounds, overlays, hero sections, text fills, borders, buttons, and progress bars.
This free online CSS gradient generator lets you build linear and radial gradient backgrounds visually, see a live preview as you adjust settings, and copy the finished CSS code in one click.
background property and paste it directly into your stylesheet.A linear gradient transitions colors along a straight line. The direction is controlled by an angle or a keyword. 0° points upward (bottom to top). Angles increase clockwise. Here are the most-used values:
/* Top to bottom */
background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
/* Left to right */
background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
/* Diagonal (most popular) */
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
/* Three-color gradient */
background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%);
/* Hard colour split (no blend) */
background: linear-gradient(90deg, #e74c3c 50%, #3498db 50%);
Radial gradients radiate outward from a center point. The shape can be circle (equal radius in all directions) or ellipse (default, stretches to fit the element):
/* Basic radial gradient */
background: radial-gradient(circle, #667eea 0%, #764ba2 100%);
/* Spotlight effect from top-left */
background: radial-gradient(circle at top left, #ffecd2 0%, #fcb69f 100%);
/* Soft glow on dark background */
background: radial-gradient(ellipse at center, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
Gradient backgrounds are used across almost every modern UI. Here are the most practical patterns:
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.8) 100%)background-clip: text; -webkit-text-fill-color: transparentbackground: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)border-image with a gradient for colourful card bordersColor stops define where each color starts and ends. By default, colors transition smoothly between stops. To create a hard edge with no transition, place two stops at the same position:
/* Hard split — no blending */
background: linear-gradient(red 50%, blue 50%);
/* CSS-only stripes */
background: repeating-linear-gradient(
45deg,
#606dbc,
#606dbc 10px,
#465298 10px,
#465298 20px
);
Copy any of these directly into your CSS. All are production-ready and tested across browsers:
linear-gradient(135deg, #f5af19 0%, #f12711 100%)linear-gradient(135deg, #2980b9 0%, #6dd5fa 50%, #ffffff 100%)linear-gradient(135deg, #134e5e 0%, #71b280 100%)linear-gradient(135deg, #667eea 0%, #764ba2 100%)linear-gradient(135deg, #f4c2c2 0%, #c9a0a0 100%)linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%)linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%)linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%)radial-gradient(ellipse at center, #1a1a2e 0%, #0f3460 100%)Linear and radial gradients are supported in all browsers released after 2012. The -webkit- prefix is no longer required for modern browsers. This tool generates clean, prefix-free CSS that works in Chrome, Firefox, Safari, and Edge.
This tool runs entirely in your browser. No data is sent to any server.
A linear gradient transitions colors along a straight line (top to bottom, left to right, or any angle). A radial gradient radiates outward from a center point in a circular or elliptical pattern. Linear gradients are more common for CSS gradient backgrounds; radial gradients work well for spotlight or glow effects.
Add extra color stops to the CSS manually after copying. For example: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%) creates a smooth three-color gradient. Each stop needs a color and a position (0–100%).
The angle controls the direction of a linear gradient. 0deg goes bottom to top, 90deg goes left to right, 180deg goes top to bottom, and 270deg goes right to left. Any angle between 0 and 360 is valid. 135deg is a popular diagonal direction.
Yes. Apply the gradient as a background on the text element, then add: -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; This clips the gradient to the text shape and works in all modern browsers.
Linear and radial gradients are supported in all modern browsers including Chrome, Firefox, Safari, and Edge. The -webkit- prefix is no longer needed for modern browsers but is still sometimes included for older Safari compatibility.