YourFileKit
Esc
All articlesDesign & CSS

How CSS Gradients Actually Work (And Why Yours Might Look Banded)

Linear vs radial gradients, what a color stop actually controls, and the real reason smooth gradients sometimes show visible stripes.

August 17, 20264 min read

A CSS gradient looks like a single smooth color transition, but under the hood it's built from a small number of explicit control points, and most of what makes a gradient look right or wrong comes down to how those points are placed.

What a color stop actually controls

A gradient is defined by a list of color stops, each one a color plus (optionally) a position along the gradient's path. The browser interpolates smoothly between consecutive stops. A simple two-color gradient has exactly two stops, at the start and end. Nothing stops you from adding more:

background: linear-gradient(90deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);

That third color stop in the middle isn't decorative, it's a real control point the gradient passes through at exactly the 50% mark, which is how a gradient goes from a simple two-color fade to a more deliberate multi-color transition. CSS Gradient Generator builds this visually, with a live preview and copyable CSS, which makes it much faster to see what adding, removing, or repositioning a stop actually does than reasoning about it from the syntax alone.

Linear vs. radial: different shapes, same underlying idea

A linear gradient transitions along a straight line at a chosen angle, 90deg moves left-to-right, 180deg top-to-bottom, and so on. A radial gradient instead transitions outward from a center point in a circle or ellipse, which is why it's the natural choice for a spotlight or glow effect rather than an edge-to-edge fade. Both are built from the same core concept, an ordered list of color stops, just interpolated along a different shape of path. Neither is more "correct" than the other, the choice comes down to whether the effect you want reads as directional (linear) or radiating from a point (radial).

Why gradients sometimes show visible banding

This is the most common thing that makes an otherwise correct gradient look wrong: instead of a smooth blend, you see faint but visible stripes, like a topographic map instead of a photograph. This is color banding, and it's a genuine rendering limitation, not a mistake in the gradient's definition.

It happens because color is stored with limited precision (commonly 8 bits per channel, giving 256 possible values per channel). Stretched across a large, smooth area between two colors that are close in hue, there often aren't enough distinct intermediate values to represent a perfectly smooth transition, so the display falls back to visible discrete steps instead. It shows up most on large flat surfaces (a full-width hero background, say) and least on smaller or busier areas where the banding has less room to become visible.

The most reliable fix is adding one or two intermediate color stops rather than relying on the browser to interpolate smoothly across a wide gap on its own, since more explicit stops give the renderer more real control points to work from instead of stretching a long interpolation between just two. CSS Filter Generator is a related but different tool worth knowing about here: it adjusts an existing image or element (blur, brightness, contrast, saturation) rather than building a gradient from scratch, useful once you've got a background gradient in place and want to fine-tune how content sits on top of it.

Picking colors that actually work together

A gradient between two colors picked at random often looks muddy in the middle, especially across a wide hue difference, since the interpolated midpoint colors are whatever falls between them on the color wheel, which isn't always a pleasant color in its own right. One practical way around this: pull colors from something that already looks good together instead of guessing. Color Palette Extractor pulls the dominant colors out of any image as hex codes, which is a fast way to get a gradient's start and end (or middle) colors from a photo, a logo, or existing design work that already has a color relationship you like, rather than starting from an arbitrary pair of hex values.

Practical takeaways

  • A color stop is a real control point, not decoration, add more of them for finer control over the transition.
  • Linear vs radial is about the shape of the path, not which one is "better." Match it to whether the effect should read as directional or radiating.
  • Visible banding means the gradient needs more stops, particularly across a wide color gap on a large surface.
  • Pull gradient colors from an existing palette rather than guessing two hex values that might not blend well together.

The short version

A CSS gradient is built from explicit color stops the browser interpolates between, and most gradient problems, whether it's a transition that looks wrong or one that visibly bands, come down to not having enough of those stops placed deliberately. Add intermediate stops for finer control and to fix banding, and choose colors that already relate to each other rather than picking two values at random.

Tools mentioned in this article

Frequently asked

What's the difference between a linear and a radial gradient?

A linear gradient transitions along a straight line at a chosen angle, edge to edge. A radial gradient transitions outward from a center point in a circle or ellipse. Same underlying idea (color stops along a path), different shape of path.

Why does my gradient show visible stripes instead of a smooth blend?

This is color banding, and it happens most often on a large, smooth area transitioning between two colors that are close in hue, because there aren't enough distinct color values available to render a perfectly smooth step between them. Adding an intermediate color stop or two usually fixes it.

Can I use more than two colors in a gradient?

Yes, and it's normal to. A gradient can have as many color stops as you want, each with its own position along the gradient line, which is exactly how more complex, multi-color gradients are built.

Design & CSS

More guides like this

Practical, tool-linked how-tos across PDF, image, finance, video, and more, no signup to read them.

Browse all articles