CSS Glitch Text Effect
Design an animated glitch heading for your website. Pick the colors, size and motion, preview it live and copy the HTML and CSS.
How to use the CSS glitch text effect generator
- Type your heading text.
- Set the font size, the offset (how far the colored copies shift) and the cycle length (how long each glitch cycle takes).
- Pick the text color and the two channel colors. Cyan and magenta give the classic “broken screen” look.
- Choose how the animation plays. Play 3 times, then stop is the most accessible choice.
- Copy the HTML into your page and the CSS into your stylesheet.
How the effect works
The heading is shown three times. The real text sits in the middle. Two copies are drawn on top with the ::before and ::after pseudo-elements, using content: attr(data-text) to repeat the heading. Each copy is shifted a few pixels left or right and given a colored shadow, like a misaligned color channel on an old screen.
The glitch itself comes from clip-path: inset(). It cuts each copy down to a thin horizontal slice. The keyframe animation moves the slice up and down, so different strips of the text jump out of line. Our CSS glitch text effect tutorial walks through the code line by line.
Accessibility built in
- No double reading. The copies use
content: attr(data-text) / "", which gives the generated text an empty alternative so screen readers read the heading once. Browsers that do not understand this syntax use the line before it. - Reduced motion. A
prefers-reduced-motionmedia query stops the animation for visitors who ask their device for less motion. - A way to stop. Under WCAG 2.2.2, motion that starts by itself and runs for more than five seconds needs a way to pause it. Playing three short cycles, or only on hover, avoids the problem.
- Real text. The heading stays plain text, so it is searchable, selectable and translatable.
Keep the effect to one short heading per page, and do not make it flash. Rapid flashing of large areas can trigger seizures, and WCAG asks for no more than three flashes per second.
Frequently asked questions
Does it need JavaScript?
No. The effect is pure HTML and CSS. JavaScript is only used on this page to build the preview.
Can I use a different font?
Yes. Change the font line in the .glitch rule. Heavy, wide fonts show the effect best.
Can I use it on more than one heading?
Yes. Add the glitch class and a matching data-text attribute to each one. The data-text value must match the heading text exactly.
Share this
More text tools
-
Glitch Text Generator
Corrupted, creepy text in a dozen styles, ready to copy and paste.
-
Zalgo Text Generator
Stack marks above, through and below every letter, with full control.
-
Cursed Text Generator
Swap letters for strange look-alikes and add as much chaos as you like.
-
Fancy Text Generator
Bold, script, gothic, bubble and more Unicode font styles.
-
Strikethrough Text Generator
Strike out, slash, underline or overline text for any app.
-
Upside Down Text Generator
Flip text upside down, or mirror it back to front.
-
Vaporwave Text Generator
Wide aesthetic text with optional spacing and decorations.
-
Invisible Character
Copy blank characters for empty names, messages and spacing.
-
Zalgo Text Remover
Clean glitch marks and fancy fonts back to plain text.