Why Your Dark Gradients Have Ugly Stripes: The CSS Banding Fix

October 5, 2026  |  8 min read  |  CSS

By Syed · Frontend Engineer & Creator of UITweak

Your dark hero section was supposed to fade smoothly from deep blue to black. Instead it shows visible stripes, like contour lines on a map, especially on larger screens. This is gradient banding, and it is not a bug in your code: it is 8-bit color running out of steps in the dark range. The good news is that four practical fixes eliminate it almost entirely.

30-second diagnosis: take a screenshot of the striped area and zoom in. If you see discrete flat steps of color, that is banding, and this guide fixes it. If you see blocky compression squares instead, especially in exported images or video, that is compression artifacting, a different problem with different fixes.

Why Dark Gradients Band

Screens render 256 distinct values per color channel. A gradient from #0a1628 to #000000 spans only a handful of those values across hundreds of pixels, so the browser has no choice but to paint visible steps. Human vision makes it worse: our eyes are most sensitive to small luminance changes in dark tones, which is exactly where the steps are largest relative to what we can perceive. Bright gradients have the same math, but we barely notice.

Fix 1: Add Dithering with an SVG Noise Overlay

The professional fix is dithering: adding a whisper of noise that breaks up the visible steps. The eye averages the noise into smooth tone, and the stripes vanish. The standard recipe is a tiny tiled SVG using feTurbulence, laid over the gradient at very low opacity:

.hero {
  position: relative;
  background: linear-gradient(to bottom, #0a1628, #000000);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05; /* 3-5% is the sweet spot */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

Keep the overlay opacity between 3% and 5%. Below that the banding survives; above it the noise itself becomes visible grain. The 200px tile repeats seamlessly, costs almost nothing to render, and works over any gradient underneath. This one fix alone resolves most banding complaints.

Fix 2: Interpolate in OKLCH

By default CSS interpolates gradients in sRGB, which takes a long, muddy path between two dark colors and concentrates the visible steps. Interpolating in OKLCH space instead takes a shorter perceptual path with more even steps:

/* default: long path through murky mid-tones */
.banded {
  background: linear-gradient(to bottom, #1e3a8a, #000000);
}

/* perceptual: shorter, more even ramp */
.smooth {
  background: linear-gradient(in oklch to bottom, #1e3a8a, #000000);
}

Two words, in oklch, and the same endpoints band visibly less. It pairs perfectly with dithering: OKLCH shortens the ramp, and the noise overlay erases whatever steps remain. For the full technique, see our OKLCH practical guide.

Fix 3: Add Intermediate Color Stops

Banding gets worse the longer a single ramp is. Splitting one long gradient into two shorter ramps with a midpoint stop gives each segment fewer pixels per color step:

/* one long ramp: maximum banding */
.banded {
  background: linear-gradient(to bottom, #1e3a8a, #000000);
}

/* two shorter ramps: visibly smoother */
.smooth {
  background: linear-gradient(
    to bottom,
    #1e3a8a 0%,
    #0d1b3e 55%,
    #000000 100%
  );
}

Pick the midpoint by eye: sample the color halfway down the original gradient and place it slightly toward the darker end, where the steps are most visible. Multi-stop gradients band less by construction, which is one reason mesh-style backgrounds look so smooth. Build yours in our free Mesh Gradient Generator: many short ramps between stops, then the noise overlay from Fix 1 on top for a flawless finish.

Fix 4: Avoid Pure Black Endpoints

Ending at pure #000000 wastes the darkest, most step-starved part of the range on a flat area where no detail exists anyway. End at a very dark tinted color instead: #050810 or a dark version of your hue. You gain usable gradient steps, the design looks richer (pure black often looks harsh next to UI elements), and the banding visibly softens because the ramp no longer dives into the range where steps are coarsest.

Quick Recap

  1. Add an SVG feTurbulence noise overlay at 3-5% opacity (the biggest win).
  2. Interpolate with in oklch for a shorter perceptual ramp.
  3. Split long ramps with intermediate color stops.
  4. End at a very dark tinted color, not pure black.

In practice, Fix 1 plus Fix 2 eliminates banding on every display we have tested, including cheap 6-bit panels. The other two are for perfectionists and hero sections.

Radial Gradients Band Worse Than Linear Ones

A linear ramp spreads its steps along one axis. A radial vignette compresses them into concentric rings, and rings read as banding even on decent panels. The worst case is the large hero vignette: the gradient spans the full viewport diagonal while the dark range still holds only a handful of 8-bit steps, so every ring is wide and obvious. The same fixes apply, but order matters here. Add midpoint stops first, because radial ramps gain the most from shorter segments, then lay the noise overlay on top. The overlay works identically over radial and conic gradients. It sits above whatever is underneath and never cares about the gradient's shape. Conic color wheels band the same way and take the same treatment.

The OKLCH Trade-Off Nobody Mentions

in oklch shortens the ramp, but it also changes what the middle looks like. sRGB interpolation between two saturated colors dives through muddy mid-tones; OKLCH takes the shorter perceptual path, which usually looks cleaner but is a genuinely different color than the default render. For dark near-monochrome ramps, the banding case this guide targets, it is a pure win. For saturated brand gradients, screenshot both versions and compare: the midpoint can shift hue enough that a designer notices. I keep sRGB for brand-critical saturated blends and use oklch for dark backgrounds. Two words in the declaration, but check the render before you ship it.

Animated Gradients: Banding in Motion

Animate a gradient and the bands start crawling. Static banding is easy to miss; moving bands catch the eye immediately, because the steps slide across pixels that cannot represent the in-between values. The noise overlay still helps: static grain over a moving gradient breaks up the step edges the same way it does when everything holds still. Keep the animation slow, and prefer moving a gradient layer with transform or opacity over repainting background-position every frame. Always check the animation on a real phone screen. The crawl is most visible there, and DevTools will not show it to you.

Verify on Your Worst Display

Banding is a display problem as much as a CSS problem, so verify on the cheapest panel you own, at low brightness, in a dim room. That combination is where the steps scream. If the gradient looks smooth there, it looks smooth everywhere. The screenshot zoom test from the diagnosis box catches the step structure objectively; the dim-room test catches what your eyes will actually see at midnight. I run both before calling a gradient done.

Frequently Asked Questions

Is banding a monitor problem or a CSS problem?

Both contribute, but you can only fix your side. Cheaper panels (especially 6-bit + dithering displays) show banding more, but the dithering overlay in Fix 1 smooths it on every panel because the noise is in the image itself, not the display.

Does the noise overlay hurt performance?

No. It is a tiny 200px tile the browser repeats, rendered once and composited. It is far cheaper than the blur filters people sometimes try instead, and unlike a blur, it does not soften your text or UI.

Why do only dark gradients band?

The math is identical for bright gradients, but human vision is far more sensitive to luminance steps in dark tones. A white-to-light-gray ramp has the same step structure; you just cannot see it.

What opacity should the noise overlay be?

Start at 4% (opacity: 0.04) and adjust by eye. Below 3% the banding survives; above 6% most people start seeing grain. Darker gradients can take slightly more.

Can I use a PNG noise instead of SVG?

Yes, but the inline SVG has no extra HTTP request, tiles perfectly, and never gets recompressed by a CDN. There is no practical reason to prefer a PNG here.

Try it now: build a multi-stop dark gradient in the free Mesh Gradient Generator, add in oklch interpolation, and finish with the noise overlay above. Banding gone.

Share this guide