What are tokens?
Tokens are chunks, not words
A language model does not receive a sentence as a row of familiar words; it receives an ordered sequence of numbered text chunks called tokens.
1Try it yourself
Simulation game
Token factory
Hit Start — watch the sentence shatter into token chips on the conveyor.
ChatGPT helps plan dinner!
Before you start
Why this matters
Look at the message “Recheck order #4812, please.” A person notices five or six meaningful items: an instruction, an order, a number, and a polite ending. A model may receive chunks resembling Re, check, order, #, 481, 2, ,, and please, followed by punctuation. That display is only an illustration; the exact split depends on the tokenizer paired with the model. The important point is that words, spaces, punctuation, and digits can cross token boundaries in ways that are invisible in ordinary reading.
2Learn the idea
Read
From text to token IDs
A token is one item from a tokenizer’s fixed vocabulary. Some vocabulary items look like complete common words. Others look like word pieces, punctuation, bytes, or a word with its leading space. Each item has an integer ID. The tokenizer turns text into IDs before the model processes it, and turns generated IDs back into readable text afterward.
Suppose a tiny demonstration vocabulary contains these entries:
241 = "Please"88 = " summarize"17 = " this"9 = "."
The text “Please summarize this.” could become [241, 88, 17, 9]. The model calculates with those IDs and their learned numeric representations, not with the printed strings themselves. Real vocabularies are much larger, and real splits differ, but the sequence idea is the same.
Tokenization is usually deterministic for a specific tokenizer and exact input. Change capitalization, spacing, or punctuation and the sequence may change. Change models and the associated tokenizer may change too.
Read
A token can be many kinds of chunk
“Token” does not mean “word.” A common word may occupy one token because it appeared frequently in training data. An uncommon name may split into several subwords. A punctuation mark may stand alone. A run of spaces may be represented differently from one space. An emoji might be one token in one vocabulary and several byte-like pieces in another.
Consider three illustrative strings:
predictablemight stay whole or split aspredict+able;unpredictabilitymight split asun+predict+ability;invoice_2026.csvmight split around the underscore, digits, and period.
These are examples of possible shapes, not promised outputs. You cannot infer an exact count just by looking at the words. Even a familiar-looking string can tokenize unexpectedly if it contains unusual Unicode characters or formatting.
This flexibility is useful. A finite vocabulary cannot contain every product code, surname, typo, URL, or newly coined term. Smaller pieces let the tokenizer represent text it has never seen as a whole.
Read
Why models predict tokens
During generation, a language model repeatedly estimates which token should come next. It selects one token, appends it to the sequence, then predicts again using the expanded sequence. A reply that appears as a smooth paragraph is therefore produced piece by piece.
This explains several visible behaviors. Streaming text arrives in small bursts because tokens are decoded as they are generated. A strict output limit can stop a response midway through a sentence because the limit counts tokens, not completed thoughts. Repeated text takes repeated computation even when a human sees it as redundant. The model also cannot directly “choose the next word” when one word may require several token decisions.
A token is not the same as meaning. The piece bank does not permanently mean a financial institution; surrounding tokens help determine whether the text concerns money or a river. Tokens are input units. Meaning arises from patterns the model learned across sequences of those units.
Read
Why counts matter
Token counts connect the text you write to three practical constraints:
- Capacity: prompts, conversation history, retrieved documents, tool descriptions, and generated output must fit the model’s available context.
- Cost: many hosted model APIs charge separately for input and output tokens.
- Latency: more input usually means more work before generation, while more output means more generation steps.
Imagine two support requests that communicate the same facts. Request A includes a 2,000-token email thread with repeated signatures. Request B contains a 350-token summary plus the five relevant messages. B leaves more room for reasoning and a complete answer. It may also cost less and respond faster. Fewer tokens do not automatically mean better results, though: removing the refund amount or policy exception would damage the task.
The goal is useful density, not minimum length.
Read
Count by measurement, not folklore
People often want a conversion between words and tokens. Any such conversion is only a rough planning estimate for a particular kind of text and language. Short English prose, source code, tables, Arabic, Japanese, emoji, and random identifiers can have very different relationships between visible length and token count.
For a real limit or invoice, use the tokenizer for the exact model or read the usage fields returned by the provider. Preserve the exact text, including system instructions and formatting. A word processor’s word count cannot tell you whether an API request fits.
Use rough estimates only for early planning, and include headroom. Replace the estimate with an actual count before production decisions.