Split-type

~4kb gzipped

Split text into characters, words, or lines -- then animate them.


01

See It in Action

Each demo pairs Split-type with GSAP. Split-type builds the DOM (chars / words / lines), GSAP animates them. Scroll or click to trigger.

Split a headline into individual characters and fade each one up with GSAP stagger. The canonical Split-type + GSAP combo.

Preview

02

What is Split-type?

Split-type is a small utility that splits text into characters, words, or lines -- wrapping each in its own <div> or <span> so you can target them with CSS or animate them with a library like GSAP or Anime.js.

It is the TypeScript-rewritten successor to Splitting.js, with ~5x the weekly npm downloads and more reliable line-detection. Split-type does nothing on its own -- it prepares the DOM, and a partner animation library does the actual motion. The pattern is so common on award-winning marketing sites that learning it unlocks a whole category of text effects.

✂️
Three Levels of Splitting
Split text into characters, words, or lines -- or all three at once. Each becomes a DOM element you can target with CSS or animation libraries.
🤝
Bring Your Own Animation
Split-type does not animate anything on its own. Pair it with GSAP, Anime.js, or Motion to stagger reveals, morph colors, or drive scroll-linked text effects.
🔁
Revert and Re-split
split.revert() restores the original DOM and you can re-split on resize or when content changes. Great for responsive line-splits that react to width.

03

When to Use Split-type

Use when
Hero headlines that animate in char-by-char with GSAP stagger
Word-stagger reveal on scroll-into-view (pair with ScrollTrigger)
Line-by-line fade for long quotes or testimonials
Color-cycling or gradient-sliding effects across characters
Animated text swaps and cross-fades between headlines
Avoid when
Simple typewriter effect -- use Typed.js or TypeIt instead
Static text where no animation is needed -- splitting adds DOM nodes for nothing
Very long body copy -- hundreds of per-character spans can hurt performance

04

How Split-type Compares

Split-type vs Splitting.js

Splitting.js was the original. Split-type is the TypeScript successor with ~5x the weekly downloads and more consistent line-splitting behavior. New projects should pick Split-type unless a tutorial or existing codebase already uses Splitting.js.

Split-type wins at
5x weekly npm downloads, active maintenance, TypeScript types, more reliable line detection, cleaner API
Splitting.js wins at
CSS variables per character (--char-index, --word-index), more tutorials and blog posts, slightly wider plugin ecosystem (for what remains)
Split-type vs GSAP SplitText

SplitText is a paid Club GreenSock plugin with the tightest integration with GSAP timelines. Split-type is MIT-compatible and free. For most projects the extra polish of SplitText is not worth the Club subscription; pair Split-type with free GSAP and you get 90% of the effect.

Split-type wins at
MIT-compatible license, free forever, pairs with any animation library
GSAP SplitText wins at
Official GSAP integration, handles edge cases (emojis, RTL, complex fonts) better, more robust line splitting on resize, paid support
Split-type vs Manual CSS / @keyframes

For a single character-by-character reveal you can write one @keyframes with animation-delay per character. At 3+ effects it becomes unmanageable. Split-type gives you clean DOM to target; an animation library does the timing.

Split-type wins at
DOM-level control, can target words or lines (not just chars), pairs with any animation tool, CSS variables for stagger
Manual CSS / @keyframes wins at
Zero JS dependency, simpler for very small effects, no DOM mutation, friendlier for accessibility

05

Get Started with Split-type

Terminal
npm install split-type
Terminal
yarn add split-type
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/index.min.js"></script>
Quick Start
<h1 class="headline">Hello, world.</h1>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
<script>
  // Split the headline into individual character spans.
  const split = new SplitType(".headline", { types: "chars" });

  // Animate each character in with GSAP, staggered.
  gsap.from(split.chars, {
    opacity: 0,
    y: 20,
    duration: 0.6,
    stagger: 0.04,
    ease: "power3.out"
  });

  // split.revert() restores the original DOM if you need to re-split on resize.
</script>

06

Related Libraries