🔪 Machines That Talk · Day 1

The Word-Chopping Machine

A chatbot can't read letters like you do. First it chops your text into little pieces called tokens — and here's the wild part: tokens are what you pay for. Let's watch the chopper work on anything you type.

↓ start chopping
🔪 Lab · The Tokenizer

Type something. Watch it get chopped.

Every colored chunk below is one token. Notice: common words are usually 1 token, but long or rare words break into pieces. Type your name, a big number, or an emoji and see what happens!

0TOKENS
0letters (characters)
0letters per token

🟦 word piece   🟨 digit   🟪 emoji / other language   ⬜ symbol. The little number under an emoji is how many tokens it secretly costs!

🐞 Break-It Challenge

Make the count go weird

Tap each button — it drops that text into the chopper above. Guess what'll happen before you tap. Some tiny things cost a shocking number of tokens!

Watch for this: "123456789" is just 9 characters but becomes 9 tokens — numbers get chopped digit-by-digit. One emoji can be 3–4 tokens. A word in another language can cost a token per letter. That's why the same sentence can be cheap in English and pricey in emoji!

🧑‍🏫 Grown-ups: this is a simplified tokenizer for learning. Real ones (like GPT's tiktoken) split numbers, emoji, and other languages a bit differently — but the lesson always holds: tokens ≠ letters, and some characters cost far more than others.
🏷️ The pro wordThose chunks are called tokens, and the chopper is a tokenizer. The method it uses — start with letters, then glue the most common pairs into bigger pieces — is called Byte-Pair Encoding (BPE). Every AI you use (ChatGPT, Claude, Gemini) counts your bill in tokens, not words.
🎯 Boss Build · Token Guesser

Train your token-sense

A phrase appears. Guess how many tokens it is with the slider, then hit Reveal. Get within 2 and you score. Nail 3 phrases to win the badge!

8

your guess (tokens)

Nailed: 0 / 3
🚀 Beyond the Basics

How the pros really do it

Our chopper is a mini version of the real thing. Here's how tokenizing grew up — from dead simple to what powers real AI:

✂️

Split on spaces (what you'd try first)

Just cut at every space = "words". ✅ Super simple. ⚠️ Every new or misspelled word is a mystery, and the dictionary gets huge.

🧩

Sub-word pieces (what you built)

Break rare words into common pieces ("un + believ + able"). ✅ Handles any word. ✅ Small vocabulary. ⚠️ Numbers & emojis split oddly.

🧠

Learned tokenizers (the real deal)

Learn the best pieces from billions of words of text. ✅ Efficient. ✅ Works in every language. ⚠️ You have to know its quirks to save money.

🏷️ Pro names to look upThe real algorithms are BPE (used by GPT), WordPiece (used by BERT), and SentencePiece / Unigram. OpenAI's tokenizer library is called tiktoken — you can try the real one online.
🔬 Real Model Lab

Now run the REAL thing — on your device

Everything above was a teaching tokenizer. This is the actual GPT-2 tokenizer — the real BPE that powers real models — running 100% on your own device, no server, and no internet once it loads. Load it once (~2 MB) and compare the counts!

not loaded

🎉 Day 1 Complete!

You met the token — the tiny piece of text that AI reads and charges for. You saw that tokens aren't words, and that numbers, emojis, and other languages tokenize in surprising ways. This is the foundation of everything about AI cost.

Day 2: The Token Price Tag →
Tomorrow: now that you can count tokens, we put a price tag on them — your very first AI receipt. 🧾
AI Adventure · Machines That Talk · Day 1 — made for young inventors 🚀