What Is a Token in an LLM? Tokens Explained Simply and Technically
By LatestLLM Editorial · Published · Facts verified · 10 min read
Also called: tokens, LLM token, token count
In one line
A token is the small piece of text, often a word or part of a word, that a language model reads, counts and generates one at a time.
Token, simply and technically
In plain English
A language model does not read your message letter by letter or word by word. It first chops the text into small pieces called tokens. A common word like "cat" is usually one token. A longer or rarer word like "unbelievably" is split into several pieces, here "un", "bel" and "ievably". Punctuation, spaces and emoji become tokens too.
Tokens matter to everyone who uses ChatGPT, Claude or Gemini, because almost every limit is measured in them. The price of an API call, how long a conversation can get before the model forgets the beginning, and how long an answer is allowed to be are all counted in tokens, not words or pages.
Think of it like this: Think of tokens as the Lego bricks of text. The model never sees the finished castle, only a row of standard bricks it knows by number. Common words are big single bricks; unusual words are built from several small ones. The comparison breaks down in one way: unlike Lego, the set of bricks is fixed when the model is built and can never be extended by the user.
Everyday example: Counting the pieces of a short message
You type a short sentence into a chatbot that uses GPT-4o's tokenizer.
Input:
The cat sat on the mat.
Output:
7 tokens: The | cat | sat | on | the | mat | .
What it shows: Six words became seven tokens because the full stop counts as its own piece. Notice that the space travels with the word after it: the model stores " cat" with its leading space as one piece. This is why a token count is close to, but never exactly, a word count.
Technically
A token is an integer id into the model's vocabulary, a fixed table of text pieces learned before training. Tokenization maps a string to a sequence of ids, the model consumes and predicts ids, and detokenization maps generated ids back to text. GPT-4o's o200k_base encoding has 200,019 entries; gpt-oss pads the same scheme to 201,088 rows to make room for its chat-format special tokens; Gemma 4 uses 262,144 and DeepSeek-V3 uses 129,280.
Everything that scales with sequence length scales with tokens: the attention cost of a forward pass, the size of the key-value cache, the context window (131,072 tokens for gpt-oss, 262,144 for the larger Gemma 4 sizes, 163,840 for DeepSeek-V3) and per-token API billing. Generation is autoregressive, one token per decoding step, so output length in tokens sets latency.
Technical example: Encoding text with o200k_base
Encode a few strings with OpenAI's open-source tiktoken library and inspect ids and pieces.
Input:
Hello world / unbelievably / 2026-11-23
Code (python):
import tiktoken
enc = tiktoken.get_encoding("o200k_base")
for text in ["Hello world", "unbelievably", "2026-11-23"]:
ids = enc.encode(text)
pieces = [enc.decode([i]) for i in ids]
print(ids, "->", pieces)
print(enc.n_vocab) # 200019
Output:
[13225, 2375] -> 'Hello', ' world'
[373, 9880, 153516] -> 'un', 'bel', 'ievably'
[1323, 21, 12, 994, 12, 1860] -> '202', '6', '-', '11', '-', '23'
What it shows: Frequent strings get a single id; rarer ones are composed from several. A date costs six tokens because digits are grouped in runs of at most three and each hyphen is separate. These ids, not characters, are what the embedding layer looks up.
What a token is
In plain English: A token is one entry in a fixed list of text pieces the model learned before it was trained. When you send a message, every part of it is matched to entries in that list, and the model only ever works with the list positions. Common words get their own entry, while rare words are spelled out with several smaller entries.
Think of it like this: A token id is like a product barcode: the till does not care what the product looks like, only which number it scans.
Technically:
Formally a token is an index t in {0, ..., V-1}, where V is the vocabulary size. The tokenizer is a deterministic function from strings to sequences of indices, and it is lossless: decoding the ids reproduces the original bytes exactly. Modern tokenizers work on UTF-8 bytes, so any input, including emoji or binary noise, can be encoded without an unknown-token fallback.
Vocabularies also contain special tokens that never come from user text, such as <|endoftext|> (id 199999 in o200k_base) or the role markers of a chat template. They delimit documents, turns and tool calls, and the model learns to emit them to signal that it has finished.
Go deeper: details for practitioners
- Because decoding is per token, a multi-byte character can be split across two tokens. Decoding a single one of those ids yields an incomplete byte sequence, which is why streaming APIs sometimes buffer a few bytes before showing a character.
What is a vocabulary?
The fixed table of every token a model knows, each with an integer id. It is created before training and cannot change afterwards without retraining the embedding layer.
What is a special token?
A reserved id used for structure, such as end-of-text or the start of an assistant turn, rather than for ordinary text.
How tokens are counted
In plain English: A useful rule of thumb for English is that 100 tokens are about 75 words. That rule only holds for ordinary English prose. Numbers, code, uncommon names and many other languages use more tokens for the same amount of meaning, because their pieces appeared less often in the text the tokenizer was built from.
Technically:
OpenAI's guidance for English is about four characters, or three quarters of a word, per token. Measured with o200k_base, a 128-character, 22-word English passage about tokens encodes to 24 tokens, about 5.3 characters per token. Short common words are cheap; the ratio drops for text that is out of distribution for the tokenizer's training data.
Other scripts show the variance clearly. "Bonjour le monde" is three tokens, matching its three words. "नमस्ते दुनिया" (Hindi, two words) is five tokens because the first word is split into four pieces, while the Japanese "こんにちは世界" is only two. The exact ratio depends on how much of each language the tokenizer saw when its vocabulary was learned.
Everyday example: Why a long number costs more than you expect
You paste an order number, 12345678, into a chat.
Output:
3 tokens: 123 | 456 | 78
What it shows: To you it is one item, but the model sees three pieces. Long ids, phone numbers and dates add up quickly in a long prompt.
Go deeper: details for practitioners
- Digit handling is a design choice. o200k_base groups digits in runs of up to three, so 12345678 becomes 123 | 456 | 78. Other tokenizers split every digit separately, which costs more tokens but gives the model a consistent view of place value.
Is a token the same as a word?
No. A token can be a whole word, part of a word, a single character, a space-plus-word or a punctuation mark.
Tokens set cost, context and speed
In plain English: Paid AI services charge per token, usually with separate prices for what you send and what the model writes back. The context window, the amount of text a model can consider at once, is also a token budget. When a conversation grows past it, the oldest parts must be dropped or summarised. And because a model writes one token at a time, a longer answer simply takes longer to arrive.
Technically:
The context window is the maximum sequence length the model was trained or extended to handle: 131,072 tokens for gpt-oss, 262,144 for the larger Gemma 4 variants and 163,840 for DeepSeek-V3. Prompt and completion share it. Every token in the window occupies a slot in the key-value cache of every attention layer, so memory grows linearly with tokens and attention compute grows with the number of token pairs.
Decoding emits one token per forward pass. Throughput is usually reported in tokens per second, and time to first token is dominated by processing the prompt. Billing APIs count input and output tokens separately because the prompt is processed in parallel while output tokens are produced sequentially, which costs more per token.
Go deeper: details for practitioners
- Speculative decoding and multi-token prediction heads, used by DeepSeek-V3, let a model propose several tokens per step and verify them together. They speed up generation without changing what a token is.
What is a context window?
The maximum number of tokens, prompt plus answer, a model can attend to in one request.
What is time to first token?
The delay between sending a request and receiving the first generated token, mostly spent processing the prompt.
Why tokens explain some odd model behaviour
In plain English: Some famous chatbot mistakes make sense once you know about tokens. Asking how many letter r's are in "strawberry" is hard for a model because it may never see the separate letters. The word arrives as one or a few chunks, so counting letters is like asking someone to count the bricks inside a brick they cannot open.
Technically:
In o200k_base, " strawberry" with a leading space is a single token, id 101830, while "strawberry" at the start of a string is three: st | raw | berry. The model must learn the spelling of each token indirectly from training text, so character-level tasks such as counting letters, reversing strings or rhyming depend on knowledge that is not visible in the input.
Tokenization also explains sensitivity to whitespace and casing: " Hello" and "Hello" are different ids with different embeddings. Prompt formats that add or remove a space before a word can change the token sequence and therefore the model's behaviour, which is why chat templates are applied exactly as the model was trained.
Common misconceptions
Myth: One token equals one word.
Reality: Only for common words. Rare words, numbers and many non-English words span several tokens, while punctuation and spaces can be tokens on their own.
Myth: Every model counts tokens the same way.
Reality: Each model family ships its own tokenizer and vocabulary, so the same text can produce a different count on gpt-oss, Gemma or DeepSeek models.
Myth: A bigger context window means the model remembers everything forever.
Reality: The window is a hard token limit per request. Anything outside it is not seen at all unless the application re-sends or summarises it.
Where you'll see this
- gpt-oss architecture: gpt-oss reads 201,088 possible token ids and handles a 131,072-token context.
- Gemma 4 architecture: Gemma 4 uses a 262,144-token vocabulary shared by every size.
- DeepSeek-V3 architecture: DeepSeek-V3 predicts extra future tokens with its multi-token prediction module.
Key takeaways
- A token is a piece of text with a fixed integer id; the model reads and writes ids, never raw characters.
- In English, one token is roughly four characters or three quarters of a word, but other languages, code and numbers often need more tokens per word.
- Prices, context windows and output limits are all measured in tokens, so the token count of a prompt is the number that matters in practice.
- Each model family has its own tokenizer, so the same text can have a different token count on different models.
Frequently asked questions
How many words is 1,000 tokens?
About 750 words of ordinary English. Code, numbers and many other languages give fewer words per 1,000 tokens.
Do spaces count as tokens?
Usually a space is merged into the token of the word that follows it, as in " cat". Runs of spaces, such as code indentation, can become tokens of their own.
Why do AI APIs charge per token instead of per word?
Tokens are the unit the model actually computes on, so the cost of processing and generating text is proportional to the token count, not the word count.
How can I count the tokens in my prompt?
Use the tokenizer of the model you are calling, for example tiktoken for OpenAI models, the provider's token-counting endpoint, or the tokenizer files published with an open model.
Are tokens the same in input and output?
Yes, the same vocabulary is used for both. Providers simply price them differently because output tokens are generated one at a time.
Sources
Facts last verified November 23, 2026.