Skip to content
Knsept
Free playbook

Text scramble

A heading that "decodes" from random characters into the real words, one letter at a time.

JavaScriptUI Widgets Updated Oct 23, 2026
Live demo Reduced motion is on, so effects are toned down
<h2 class="scramble" data-phrases='["Decoding the message","Hello, world","Ship it today"]'>Decoding the message</h2>
<button class="scramble-next" type="button">Next phrase</button>

Each letter gets its own "lock-in" frame: later letters lock in later, plus a bit of randomness so the reveal doesn't look mechanical. Until a letter locks in, it shows a random character from noiseCharacters.

A monospace font keeps every character the same width, so the heading doesn't jiggle while it scrambles. aria-label holds the real phrase, so screen readers announce the words, not the noise.

Safety note: innerHTML is used to color the noise, which is fine because the text comes from your own phrase list. The script also escapes < and &, so a stray character can't break the markup.

With reduced motion on, the scramble is much shorter, so the text settles in a fraction of a second.

More from the library

Text effects live

Seamless marquee

An endless scrolling strip of logos or tags. Pure CSS loop with a pause button; slower, never stopped, with reduced motion.

Text effects live

Shimmer text

A headline with a band of light sweeping across it, using background-clip text. Pure CSS, a few lines.

Text effects live

Typewriter rotator

Types, pauses, deletes, and cycles through phrases with a blinking caret.