Stage 2 · Teens · Foundations
Tokens & Tokenization
How raw text gets converted into the units a model actually processes.
Models don't read text as letters or words — they read tokens. A token might be a whole word, part of a word, a punctuation mark, or even a single character, depending on how common that chunk of text is.
Splitting text into tokens is called tokenization. It's the very first step in getting text into a model, and the very last step in getting the model's output back into readable text.
- Common words are often a single token (e.g. "the", "is").
- Rarer or longer words get split into subword pieces (e.g. "tokenization" → "token" + "ization").
- Whitespace, punctuation, and even emoji all become tokens too.
Model pricing and context limits are measured in tokens, not characters or words. A rough rule of thumb for English is ~1.3 tokens per word (about 4 characters per token). Code, other languages, and odd formatting can be much worse. Always treat this as an estimate, not a conversion formula.
Tokenization is also more literal than it looks. The same word can tokenize differently depending on capitalization or whether it's preceded by a space — a leading-space " hello" (as it would appear mid-sentence) and a capitalized "Hello" (as at the start of a sentence) don't necessarily map to the same token as plain "hello". This matters in practice: it's part of why token counts — and therefore cost — can shift slightly depending on exact formatting, not just word count.
Worked example. A typical page of English prose is roughly 500 words. Using ~1.3 tokens per word, a 10-page document is about 500 × 10 × 1.3 ≈ 6,500 tokens. At an illustrative rate of $3 per million input tokens, that's about $0.02 to send the whole document once. That looks trivially cheap — but an agent that re-sends the same 10-page document as context on every one of 50 calls in a session is now paying for it 50 times over, which is exactly the kind of cost that motivates techniques like prompt caching and retrieving only the relevant section instead.