Typed.js

~7kb

Add a typewriter effect to your site — type, delete, and loop through text automatically.


01

See It in Action

Multiple strings, smart backspace, and HTML typing — beyond what CSS can do.

Cycles through multiple strings with a typewriter effect — CSS cannot handle variable-width fonts or multiple strings.

Preview

02

What is Typed.js?

Typed.js adds a typewriter effect to any website. Give it a list of strings and it types them out one by one, deletes them, and starts over — perfect for hero sections that cycle through taglines or roles.

You can control typing speed, backspace speed, and pauses between strings. It also supports typing out HTML like bold or colored text, and a smart backspace mode that only deletes the characters that differ between strings.

Typed.js is MIT licensed and free for any project, including commercial ones.

Smart Backspacing
When cycling through strings, Typed.js only deletes the characters that differ — so 'npm install react' to 'npm install react-dom' just backspaces to the hyphen.
🎨
HTML Typing
Type out bold, italic, colored text, and links character by character. You can also fade text out instead of backspacing it.
⏸️
Mid-String Pauses
Insert pauses anywhere in a string with ^1000 syntax (milliseconds). Create dramatic reveals, simulate thinking, or pace a tutorial.

03

When to Use Typed.js

Use when
Hero sections that cycle through taglines, roles, or value propositions
Portfolio sites showcasing multiple skills — 'I build apps, APIs, dashboards'
Terminal or command-line UI simulations
Chatbot or AI assistant typing indicators
Interactive storytelling with timed text reveals
Avoid when
Long-form content that users need to read quickly — a typewriter effect on a paragraph is frustrating
Accessibility-critical interfaces — always respect prefers-reduced-motion and provide a skip button
Anywhere the animated text is the only way to read essential information — users with JS disabled will see nothing

04

How Typed.js Compares

Typed.js vs TypeIt

TypeIt has more advanced features like companion methods and cursor control, but requires a paid license for commercial use (GPL-3.0 otherwise). Typed.js is simpler, smaller, and MIT licensed — free for everything including commercial projects.

Typed.js wins at
Smaller bundle, simpler API, MIT license (free for commercial use)
TypeIt wins at
More methods (move, delete, exec), better cursor control, active development
View Full Comparison →
Typed.js vs CSS Animations

CSS can create a basic typewriter effect for a single fixed-width string, but it falls apart with variable-width fonts or multiple strings. Typed.js handles both effortlessly.

Typed.js wins at
Variable-width fonts, multiple strings, smart backspace, HTML typing
CSS Animations wins at
Zero JavaScript, no dependencies, simpler for single fixed-width text
View Full Comparison →

05

Get Started with Typed.js

Terminal
npm install typed.js
Terminal
yarn add typed.js
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/typed.umd.js"></script>
Quick Start
import Typed from 'typed.js';

const typed = new Typed('#element', {
  strings: ['First sentence.', 'Second sentence.'],
  typeSpeed: 50,
  backSpeed: 30,
  loop: true
});

06

Related Libraries