Tokenization Explained: How Language Models Read Text

Tokenization explained in plain terms means splitting text into small pieces, called tokens, before a language model reads it. The central question is why a model does not simply read whole words, and the short answer is that tokens let it handle any text, including rare words and new words, with a fixed and manageable vocabulary.

Think of building with bricks. A builder who only has whole rooms cannot build a new shape, but a builder with small bricks can build almost anything. Tokens are the bricks of language for a model: by combining a limited set of pieces in different ways, the model can represent any word it meets, familiar or not.

Key takeaways

  • Tokenization splits text into tokens before a language model reads it.
  • A token can be a whole word, part of a word, or a single character.
  • Tokens let a model handle rare and new words with a fixed vocabulary.
  • The same text can be split differently by different tokenizers.
  • Token counts shape how much text a model can read or write at once.

What tokenization is

Tokenization is the first step in preparing text for a language model. Before the model can do anything with a sentence, the sentence must be broken into tokens, and each token is then turned into a number that the model can process. The model never sees raw letters; it sees a sequence of token numbers.

A token is usually a piece of a word rather than a whole word. Common words such as the or and may each be a single token, while a longer or rarer word may be split into several tokens. The word unhappiness, for example, might be split into un, happi, and ness, or into pieces like it, depending on the tokenizer in use.

The vocabulary is the full set of tokens a model knows. It is fixed when the model is trained, and it usually contains tens of thousands of tokens. Any text can be represented by combining tokens from this set, which is what makes the approach flexible enough to handle new words, names, and spellings.

How tokenizers are built

Tokenizers are built by studying large amounts of text and learning which pieces of words appear most often. The process starts with individual characters and repeatedly merges the most frequent adjacent pairs into longer tokens. Common words end up as single tokens, while rare words are left as smaller pieces.

This approach is a compromise. A vocabulary of whole words would be enormous and would still fail on any word it had never seen.

A vocabulary of single characters would be tiny but would make every sentence very long in tokens. Splitting words into pieces sits between the two: the vocabulary stays manageable and no word is ever impossible to represent.

Different models use different tokenizers, so the same sentence can be split into different numbers of tokens by different systems. Our guide to transformer models explains the architecture that reads these token sequences and turns them into understanding, and our guide to large language models shows how tokenized text flows through a full model.

Why tokenization matters

Tokenization matters because it shapes how much a model can read at once. Models have a limit on the number of tokens they can process in one go, known as the context window. A long document that uses many tokens per word will fill that window faster than one written in short, common words, even if the two documents are the same length on the page.

It also affects cost and speed. Systems often charge by the token, so a text that splits into many tokens costs more to process than one that splits into few. This is why two messages of similar length can have different token counts: uncommon words, long words, and unusual spellings all split into more pieces.

Tokenization even affects what a model finds easy or hard. A model sees tokens, not letters, so tasks that depend on spelling, such as counting letters in a word or spotting a rhyme, can be surprisingly difficult for it. The word strawberry may be split in a way that hides how many times the letter r appears, because the model never sees the letters directly.

A photograph of printed text on paper in a dark room, with individual words highlighted in soft green light
Tokenization breaks text into pieces a model can read, and the pieces are not always whole words.

Comparing ways of splitting text

Aspect Whole words Tokens Characters
Vocabulary size Very large Moderate Very small
New words Cannot represent Built from pieces Always possible
Sequence length Short Medium Very long
Meaning per unit Clear Partly clear Almost none
Used by models Rarely Almost always Rarely

Where tokenization shows up

Tokenization shows up everywhere a language model is used. When you send a message to a chatbot, the message is tokenized before the model reads it. When the model replies, it produces tokens one at a time, and those tokens are then joined back into readable text for you.

It also shows up in limits and pricing. A chat service may limit how long a conversation can grow, and that limit is measured in tokens, not words. A document summariser may refuse a file that is too long, because its token count exceeds what the model can read in one pass.

Developers meet tokenization when they build with language models. They count tokens to stay within limits, to estimate costs, and to split long documents into chunks that fit. Understanding tokens is therefore a practical skill, not just a curiosity about how models work.

Common misunderstandings

One common misunderstanding is that a token equals a word. In English, a token is often close to three quarters of a word on average, but the exact relationship varies with the text. Short common words are usually one token, while long or unusual words may be several, and punctuation and spaces can be tokens too.

Another misunderstanding is that tokenization is the same for every language. It is not.

Languages with long compound words, or with writing systems that do not use spaces, split very differently from English. A sentence that is short in tokens in one language may be long in tokens in another, which affects cost and capability for speakers of different languages.

A third misunderstanding is that tokenizers understand meaning. They do not.

A tokenizer is a mechanical process that splits text according to patterns learned from frequency. The understanding happens later, in the model that reads the tokens.

Tokenization checklist

  • Remember that models read tokens, not words or letters.
  • Count tokens, not words, when checking a model’s limits.
  • Expect rare and long words to use more tokens.
  • Test token counts on your real text, not on averages.
  • Keep prompts concise to save tokens and cost.
  • Split long documents into chunks that fit the context window.
  • Do not assume the same text costs the same in every language.
  • Check the tokenizer your model uses before estimating.
  • Remember that spelling tasks may be hard for a token-based model.

Frequently asked questions

What is tokenization?

Tokenization is the process of splitting text into small pieces called tokens before a language model reads it. Each token is turned into a number, and the model processes the sequence of numbers rather than the raw text.

What is a token?

A token is a piece of text that a model treats as one unit. It can be a whole common word, part of a longer word, a single character, or a punctuation mark. The set of all tokens a model knows is called its vocabulary.

How many words is one token?

There is no fixed answer, because it depends on the words. In English, one token is roughly three quarters of a word on average, but short common words are often one token each, while long or unusual words can take several tokens.

Why do models use tokens instead of words?

Tokens let a model handle any text with a fixed vocabulary. A whole-word vocabulary would be enormous and would fail on new words, while tokens can represent any word by combining pieces, including words the model has never seen before.

What is a context window?

A context window is the maximum number of tokens a model can process in one go. It includes both the input you give the model and the output it produces, so long conversations and long documents can fill it up.

Does tokenization differ between languages?

Yes. The way text splits into tokens depends on the language and the tokenizer. Languages with long compound words or different writing systems can use many more tokens for the same meaning, which affects cost and how much text fits in a context window.

The bottom line

Tokenization explained in one line is this: before a language model can read anything, the text is split into tokens, and those pieces decide how much the model can read, how much it costs, and what it finds easy or hard.

It is a small step that sits underneath everything a language model does. Once you understand tokens, the limits, costs, and quirks of these models start to make far more sense.

Latest articles

Scroll to Top