AI Engineering · interactive
How text becomes tokens
A model never reads letters or words. It reads tokens: chunks a tokenizer learned by merging the most common pairs of characters, over and over. Train one, then type your own text.
Characters only
vocabulary 7
- h
- u
- g
- p
- u
- g
- p
- u
- n
- b
- u
- n
- h
- u
- g
- s
Next merge: u + g (20 times)
Start: every word is split into single characters. 7 tokens in the vocabulary.
1 Training starts from the smallest pieces. Each distinct character is one token in the vocabulary.
b g h n p s u
2 3 4 5
In production
Tools and technologies
Every model ships with its own tokenizer; you count tokens to budget prompts and estimate cost, whatever your stack.
Not tied to one language — use these names when you search docs or design a system.
- tiktokenSoftware
OpenAI's fast BPE tokenizer for GPT models.
GitHub ↗ - Hugging Face TokenizersSoftware
Train and run BPE, WordPiece and Unigram tokenizers.
GitHub ↗ - SentencePieceSoftware
Language-independent subword tokenizer used by Llama, Gemma and T5.
GitHub ↗ - TiktokenizerSoftware
Paste a prompt and see its tokens for many models.
GitHub ↗ - Anthropic token countingService
Count tokens for a Claude request before you send it.
Documentation ↗