# Glitch Text

> A cyberpunk glitch effect with offset red and cyan slices.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: glitch, cyberpunk, clip-path, animation, dark
- Live preview: https://copy-css.com/snippets/glitch-text
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<h2 class="glitch" data-text="GLITCH">GLITCH</h2>
```

## CSS

```css
.glitch {
  position: relative;
  margin: 0;
  color: #fff;
  font: 900 52px/1 system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  width: 100%;
  background: #0f0f12; /* match your page background */
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 #f43f5e;
  animation: glitch-a 2.5s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: 2px 0 #22d3ee;
  animation: glitch-b 3s infinite linear alternate-reverse;
}

@keyframes glitch-a {
  0% { clip-path: inset(10% 0 80% 0); }
  20% { clip-path: inset(60% 0 20% 0); }
  40% { clip-path: inset(30% 0 50% 0); }
  60% { clip-path: inset(80% 0 5% 0); }
  80% { clip-path: inset(15% 0 70% 0); }
  100% { clip-path: inset(45% 0 40% 0); }
}

@keyframes glitch-b {
  0% { clip-path: inset(70% 0 10% 0); }
  25% { clip-path: inset(20% 0 65% 0); }
  50% { clip-path: inset(50% 0 30% 0); }
  75% { clip-path: inset(5% 0 85% 0); }
  100% { clip-path: inset(85% 0 2% 0); }
}

@media (prefers-reduced-motion: reduce) {
  .glitch::before,
  .glitch::after {
    display: none;
  }
}
```

## Notes

- This CSS Glitch Text is 52 lines of pure CSS (1.1 KB) with no JavaScript and no dependencies. It uses keyframe animations, text shadows, clip paths and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
