HomeBlogCSS Gradient Generator
💻 Dev Tutorial

CSS Gradient Generator: Linear, Radial & Conic Explained

By Color Picker Web · Updated August 2026 · 12 min read

A CSS gradient is one line of code standing in for what used to require a designed, exported, and uploaded image file: background: linear-gradient(135deg, #3B82F6, #EC4899);. No HTTP request, no fixed resolution, no file size — just a formula the browser paints natively, scaling perfectly to any container.

This guide covers all three gradient types — linear, radial, and conic — plus gradient text, mesh gradients, and the accessibility catch most tutorials skip. Build yours live below and copy the exact CSS.

🧪 Try It: Live CSS Gradient Generator

Pick a gradient type, choose two colors, and adjust the angle — the preview and the exact CSS code update instantly. Copy it straight into your stylesheet.
🧪 Interactive Tool

✦ What Is a CSS Gradient?

A CSS gradient is a smooth color transition rendered natively by the browser as a background-image value, without loading a separate image file. Gradients come in three types — linear, radial, and conic — each generated with its own CSS function and used the same way any background image would be.

Because gradients are pure CSS, they're typically 50-200 bytes of code compared to 5-50KB or more for an equivalent exported PNG — smaller, sharper at any size, and instantly editable without touching design software.

📏 Linear Gradient Syntax

linear-gradient(angle, color1, color2) creates a color transition along a straight line. The angle can be a degree value (0deg is horizontal, 90deg is vertical, 45deg is diagonal) or a side/corner keyword like "to right" or "to bottom right."
/* By angle */
background: linear-gradient(135deg, #3B82F6, #EC4899);

/* By keyword */
background: linear-gradient(to right, #3B82F6, #EC4899);

/* Multiple color stops with positions */
background: linear-gradient(90deg, red 0%, yellow 50%, green 100%);

The gradient line runs from the element's center outward in the given direction — colors are distributed along that line based on their position, defaulting to evenly spaced if no percentages are given.

⭕ Radial Gradient Syntax

radial-gradient(shape at position, color1, color2) creates a color transition radiating outward from a center point in a circle or ellipse. The at keyword sets the center position, such as "at 30% 70%," letting you offset the gradient's origin away from the element's default center.
/* Default: ellipse from center */
background: radial-gradient(#3B82F6, #EC4899);

/* Circle, offset position */
background: radial-gradient(circle at 30% 70%, #3B82F6, #EC4899);

Radial gradients are the foundation for glow effects, spotlight overlays, and adding a sense of depth to otherwise flat interfaces.

🎡 Conic Gradient Syntax

conic-gradient(from angle at position, color1, color2) transitions colors around a center point like a color wheel or pie chart, rather than outward along a line. The from keyword sets the starting angle of the sweep, and color-stop positions are specified as angles instead of lengths.
/* Basic conic sweep */
background: conic-gradient(#3B82F6, #EC4899, #3B82F6);

/* Custom start angle and position */
background: conic-gradient(from 90deg at 50% 50%, red, yellow, green, blue, red);

Conic gradients are exactly what powers most CSS-only color wheel widgets and pie-chart-style visualizations — including the harmony wheels used elsewhere on this site.

🎨 Need the Perfect Color Pair First?

Explore complementary colors, tints and shades to feed into your gradient — free, no signup.

Open the Free Color Picker →

✍️ Gradient Text

To apply a gradient to text instead of a background, set the gradient as background-image, add background-clip: text (with the -webkit- prefix for broader support), and set color: transparent — the text itself then reveals the gradient underneath rather than showing a solid fill.
.gradient-heading {
  background-image: linear-gradient(90deg, #7b2ff7, #f0529c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

This exact technique is what powers most of the gradient logo and heading text you see across modern SaaS and design-agency websites.

🌫️ Mesh Gradients

A mesh gradient is created by layering several radial-gradient() values on top of each other in a single background property, each positioned at a different point, producing the soft, organic, multi-colored blend that's become a defining look in 2026 hero sections and backgrounds.
background:
  radial-gradient(at 20% 20%, #a855f7 0%, transparent 50%),
  radial-gradient(at 80% 30%, #ec4899 0%, transparent 50%),
  radial-gradient(at 40% 80%, #f0529c 0%, transparent 50%),
  #f5d4b8;

This is the exact technique behind the ambient, smoky gradient look showing up across 2026 hero sections — see our 2026 web design color trends for more on where this style fits.

🔁 Repeating Gradients

repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() repeat the same color-stop pattern infinitely across an element, useful for building stripes, checkerboards, or other patterned backgrounds without needing an image file at all.
/* Diagonal stripes */
background: repeating-linear-gradient(
  45deg, #3B82F6, #3B82F6 10px, #EC4899 10px, #EC4899 20px
);

♿ Text Contrast on Gradients

Always test text placed over a gradient against the gradient's lowest-contrast region, not its average or midpoint — that's where readability is most likely to fail WCAG requirements, especially near the lighter end of a light-to-dark blend.

A gradient that looks perfectly readable in its darkest corner can silently fail contrast where it fades lighter. Check the worst-case point specifically — see our WCAG 2.2 contrast guide for exact AA/AAA thresholds.

🌍 Browser Support & Performance

All modern browsers — Chrome, Firefox, Safari, and Edge — support unprefixed linear-gradient, radial-gradient, and conic-gradient with no -webkit- or -moz- prefix required for gradients created after 2014. CSS gradients also outperform image-based gradients: typically 50-200 bytes of code versus 5-50KB or more for an equivalent image file.

Beyond file size, gradients are responsive by default — they automatically adapt to container size changes without regenerating or re-exporting anything, which a static gradient image simply can't do.

🚫 Common CSS Gradient Mistakes

  1. Forgetting the -webkit- prefix for gradient text. background-clip: text still needs -webkit-background-clip: text for full browser support.
  2. Testing contrast at the wrong point. Always check the gradient's lightest, lowest-contrast region — not the average.
  3. Overcomplicating simple backgrounds. A subtle two-color gradient often reads better than a busy multi-stop blend.
  4. Confusing conic-gradient's angle-based stops with radial's length-based stops. The two use fundamentally different positioning systems.
  5. Forgetting a solid-color fallback. Older or unusual renderers may not support every gradient type — a sensible background-color fallback costs nothing.

🏁 Conclusion

CSS gradients replace what used to be an image-export workflow with a single, editable line of code: pick linear for a straight blend, radial for a circular glow, or conic for a color-wheel sweep, then layer several radial gradients together for the mesh look defining 2026 design. Build yours in the live tool above, copy the exact CSS, and always check contrast at the gradient's weakest point before shipping text over it.

❓ Frequently Asked Questions

What is the syntax for a CSS linear gradient?

The syntax is background: linear-gradient(angle, color1, color2); where angle can be a degree value like 90deg or a keyword like "to right". For example, linear-gradient(135deg, #3B82F6, #EC4899) creates a diagonal blue-to-pink gradient.

What's the difference between linear, radial and conic gradients?

A linear gradient transitions colors along a straight line at a set angle. A radial gradient transitions colors outward from a center point in a circle or ellipse. A conic gradient transitions colors around a center point like a color wheel or pie chart.

How do I create gradient text in CSS?

Apply a gradient as background-image, set background-clip: text (with the -webkit- prefix for broader support), and set color: transparent, so the text itself reveals the gradient underneath instead of a solid fill.

Do I need vendor prefixes for CSS gradients in 2026?

No, unprefixed linear-gradient, radial-gradient, and conic-gradient are supported in all modern browsers, including Chrome, Firefox, Safari, and Edge, without requiring -webkit- or -moz- prefixes.

How do I make a mesh gradient with CSS?

Layer multiple radial-gradient() values on top of each other in a single background property, each positioned at a different point, to create the soft, organic, multi-colored blend known as a mesh gradient.

Can I use more than two colors in a CSS gradient?

Yes, list as many colors as needed separated by commas, such as linear-gradient(90deg, red, yellow, green, blue), and optionally set a specific position percentage for each color stop.

What is a repeating CSS gradient?

repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() repeat the same color-stop pattern infinitely across the element, useful for creating stripes, checkerboards, and other patterned backgrounds without an image file.

Are CSS gradients better for performance than image gradients?

Yes, CSS gradient code is typically 50-200 bytes compared to 5-50KB or more for a gradient image file, and CSS gradients render natively and scale responsively without extra HTTP requests.

How do I check contrast on text placed over a gradient?

Test your text color against the lowest-contrast region of the gradient, not the average or midpoint, since that's where readability is most likely to fail WCAG contrast requirements.

What does the 'at' keyword do in a radial or conic gradient?

The at keyword sets the center position of a radial or conic gradient, such as radial-gradient(circle at 30% 70%, ...), letting you offset the gradient's origin point away from the default center of the element.

← Previous Article Complementary, Triadic & Split-Complementary Color Schemes Explained (2026) Next Article → Kitchen Cabinet Color Ideas 2026 (With HEX Codes)