Making Static Noise From A Weird CSS Gradient Bug

Transform rendering quirks into creative effects by harnessing the sub-pixel chaos of CSS gradients

The TV Static That Isn't There

Remember the fuzzy static noise on old televisions when there was no signal? That distinctive visual static of random black and white dots flickering across the screen. Surprisingly, you can recreate this effect using nothing but CSS gradients and a quirk in how browsers handle sub-pixel rendering.

This technique produces surprisingly convincing TV static without any images, videos, or JavaScript. We'll explore how this works, when to use it, and how to animate it for dynamic effects. Our web development team specializes in creating engaging visual experiences using modern CSS techniques like this one.

The Surprising Origin: A Bug Become Feature

CSS gradients have a well-known limitation with anti-aliasing at hard color stops. When you specify an abrupt transition between two colors, browsers struggle to render smooth edges, resulting in jagged artifacts. Web developers typically work around this by adding tiny percentage differences (like 0.5%) between color stops to smooth transitions. But what happens if you do the opposite--exacerbating the problem deliberately?

When you push gradient color stops to extremely small values (like 0.0001%), the sub-pixel rendering calculations go haywire, producing what looks exactly like random static noise.

Why This Works

Modern displays render colors at sub-pixel precision, breaking each visible pixel into red, green, and blue components. When CSS gradients attempt to calculate color transitions at extremely fine granularities, the rounding and interpolation algorithms produce unpredictable results.

Basic Static Noise Technique

The simplest implementation uses a conic gradient with carefully chosen values. The key insight is the combination of extremely small color stop differences with a large background size.

.static-noise {
 background: conic-gradient(
 from 0deg,
 #000 0.0001deg,
 #fff 0.0002deg
 );
 background-size: 3000px 3000px;
}

This creates the appearance of random noise because the browser tiles the gradient pattern across a much larger area than its anti-aliasing algorithms can handle coherently.

Complete Noise Implementation
1/* Base noise class */2.noise {3 /* The magic: extremely small color stop differences */4 background: conic-gradient(5 from 0deg,6 #000 0%,7 #fff 0.0001%,8 #000 0.0002%,9 #fff 0.0003%,10 #000 0.0004%11 );12 /* Large size creates the noise pattern */13 background-size: 4000px 4000px;14}

Using Radial Gradients

Radial gradients offer a different noise character with circular geometry:

.radial-static {
 background: radial-gradient(
 circle,
 #000 0.0003px,
 #fff 0.0004px
 );
 background-size: 200% 200%;
}

The circular geometry produces radial noise patterns that can look like shimmering heat or underwater distortion.

Animated TV Static Effect

The real magic happens when you animate the gradient's position, creating the flickering effect of actual TV static.

@keyframes tv-static {
 0% { background-position: 0 0; }
 100% { background-position: 100px 100px; }
}

.animated-static {
 animation: tv-static 0.1s steps(10) infinite;
 background-size: 3000px 3000px;
}

The steps(10) timing function creates a jumpy animation rather than smooth movement, mimicking the discrete frame nature of broadcast television.

Animated Static with Keyframes
1@keyframes tv-static {2 0% { background-position: 0 0; }3 100% { background-position: 100px 100px; }4}5 6.animated-static {7 animation: tv-static 0.1s steps(10) infinite;8 background-size: 3000px 3000px;9 /* Performance hint */10 will-change: background-position;11}

Combining Multiple Gradients

Layering multiple gradients with different settings creates more complex visual textures.

.complex-noise {
 background: 
 radial-gradient(circle at 30% 30%, #333 0.0001%, transparent 0.0002%),
 conic-gradient(from 45deg, #000 0.0001%, #666 0.0002%, #000 0.0003%),
 linear-gradient(to bottom, #1a1a1a, #0a0a0a);
 background-blend-mode: overlay, overlay, normal;
 background-size: 200% 200%, 3000px 3000px, 100% 100%;
}

The background-blend-mode property allows noise layers to interact, adding depth to the texture.

Overlay Technique for Image Textures

A powerful application is adding noise texture to any element:

.grainy-overlay::before {
 content: '';
 position: absolute;
 inset: 0;
 background: conic-gradient(
 from 0deg,
 transparent 0%,
 #000 0.0001%,
 transparent 0.0002%
 );
 background-size: 2500px 2500px;
 mix-blend-mode: overlay;
 pointer-events: none;
}

Practical Applications

Static noise creates immediate visual interest for:

  • Retro or vintage-themed designs - Nostalgic television aesthetics
  • Tech-focused aesthetics - Cybersecurity, glitch art, digital effects
  • Loading states and placeholders - Active, intentional empty states
  • Error pages and offline indicators - Communicate 'no signal' visually

For developers working on web development projects, this technique adds visual polish without adding external assets or JavaScript dependencies.

Loading and Placeholder States

The animated noise makes excellent placeholder content while data loads:

Skeleton Loader with Noise
1.skeleton-loader {2 background: linear-gradient(3 90deg,4 #f0f0f0 25%,5 #e0e0e0 50%,6 #f0f0f0 75%7 );8 background-size: 200% 100%;9 animation: shimmer 1.5s infinite;10}

Performance Considerations

Static noise effects are computationally intensive. The cost increases with animation speed, gradient complexity, affected area, and blend modes.

Optimizing CSS animations is one of our SEO services specialties--faster loading pages improve both user experience and search rankings.

Optimization Strategies

Limit animation scope - Use a small animated element with transform: scale():

.efficient-noise {
 position: fixed;
 inset: -50%;
 width: 200%;
 height: 200%;
 animation: tv-static 0.5s steps(3) infinite;
}

Use CSS containment - The contain: paint property allows optimization:

.contained-noise {
 contain: paint;
 background-size: 1500px 1500px;
}

Consider SVG alternatives - For static noise, SVG filters are often more performant.

Performance Comparison by Technique
TechniqueStatic NoiseAnimatedBrowser Consistency
CSS GradientGoodModerate - heavyVaries
SVG FilterExcellentGoodConsistent
Canvas + JSExcellentExcellentConsistent

Browser Compatibility

The gradient noise technique works across all modern browsers but with notable differences:

  • Chrome/Edge: Best support, consistent rendering
  • Firefox: Good support, may render slightly different patterns
  • Safari: Works correctly, may have performance differences on older devices

Fallback Strategy

.noise-effect {
 background: #1a1a1a;
}

@supports (background: conic-gradient(from 0deg)) {
 .noise-effect {
 background: conic-gradient(from 0deg, #000 0.0001%, #fff 0.0002%);
 background-size: 3000px 3000px;
 }
}

Alternative Approaches

SVG Filters

SVG's feTurbulence filter provides more controlled noise:

<svg>
 <filter id="noise">
 <feTurbulence 
 type="fractalNoise" 
 baseFrequency="0.65" 
 numOctaves="3" 
 stitchTiles="stitch"/>
 </filter>
</svg>

This produces more consistent results across browsers with parameters to control noise characteristics.

When to Use What

Use CaseRecommended Approach
Lightweight noise, no animationCSS Gradient
Animated static effectCSS Gradient
Pixel-perfect noiseSVG Filter
Large areas, staticSVG or Canvas
Maximum controlCanvas + JavaScript

Conclusion

The CSS gradient noise technique transforms what was once a rendering bug into a creative tool. By understanding how sub-pixel rendering works--and deliberately breaking it--you can create convincing TV static, grainy textures, and animated noise effects using only CSS.

The key to success is moderation: use the effect where it adds genuine value, optimize for performance, and provide fallbacks for browsers or devices that struggle with the rendering cost.

When applied thoughtfully, this quirky CSS feature adds visual interest and texture that would otherwise require images, videos, or complex JavaScript.

Need help implementing advanced CSS techniques for your web project? Our web development services team can bring your creative vision to life with cutting-edge frontend development.

Frequently Asked Questions

Ready to Add Visual Texture to Your Web Projects?

Our web development team creates engaging visual experiences using modern CSS techniques.

Sources

  1. CSS-Tricks: Making Static Noise From a Weird CSS Gradient Bug - The original technique by Temani Afif
  2. CSS-Tricks: Grainy Gradients - Alternative SVG-based approach
  3. Nerdy.dev: Hacky CSS Noise with Repeating Gradients - Animated noise exploration
  4. MDN: feTurbulence - SVG filter reference
  5. MDN: @property - CSS Houdini API