What is a token?
Before a language model predicts text, that text is turned into smaller pieces. Those pieces are called tokens.
Words are not the unit.
People tend to see a sentence as words and punctuation. A tokenizer uses a vocabulary of text pieces and rules to map text to token IDs. A piece may be a whole word, part of a word, whitespace combined with another piece, punctuation, or another fragment.
For example, a familiar short word might be one token, while an unusual name or a long word might be split into several. Exact splits depend on the tokenizer. Different models can use different vocabularies and produce different counts for the same text.

Try splitting text.
Change the text and compare the word count with the pieces below. This is a simple demonstration of splitting; it does not reproduce any model’s tokenizer.
This toy splits letters and digits into chunks of up to four characters, treats punctuation separately, and omits spaces. Real tokenizers use different vocabularies and can represent spaces; these are not real model token counts.
From text to numbers—and back.
At input, the tokenizer converts text into a sequence of IDs from its vocabulary. The model works with representations of those IDs, using the surrounding sequence as context. When the model generates output, it predicts token IDs; a decoder converts the selected IDs back into text.
Follow “Hello!” from input to a hypothetical “Hi!” reply. Select each stage or use Next to see what changes.
The vocabulary, IDs, split, and model choices are invented for this example. Actual tokenizers and model outputs differ.
A user sends “Hello!”. We will follow this same example through a made-up tokenizer and a hypothetical reply.
The visible text of a token is useful for illustration, but the model processes IDs and learned numerical representations. An ID is not the meaning of a word by itself: its role depends on the model and the context.
Why the count matters.
A model’s context window limits how much input and output it can work with at once. Usage and costs may also be measured in tokens, depending on the service. Counts are not reliably equal to word counts, especially for unfamiliar names, code, punctuation, and different languages.
For an actual application, use the tokenizer and counting guidance for the model you deploy. A character or word estimate can be useful for planning, but it is not an exact count.
Check your understanding.
Take this with you.
Text is encoded into token IDs, the model works with the sequence, and output IDs are decoded back into text. Token counts affect context and often usage; a real tokenizer is the source of the exact split.