Tokens are the pieces of information an AI language model reads and writes. A token may represent a complete word, a fragment, punctuation or even a single character. Before the model processes your prompt, a tokenizer converts the text into token ID numbers. The model then generates its response one token at a time.
Tokens matter because they determine how much text a model can handle, how usage is measured and why some tasks that look easy to people are unexpectedly difficult for AI.
TL;DR
- A token is a chunk of text represented by a number. It may be a complete word, a fragment, punctuation or a character [1, 2].
- A tokenizer splits text before the model sees it. The model processes token IDs and converts its output back into readable text [3, 2].
- Token counts affect cost, speed and context limits. Counts vary by model, language and content, so word-to-token estimates are only rough guides [1, 4].
What Is a Token in AI?
A token is one item in the sequence a language model processes. The model’s tokenizer breaks your text into pieces and assigns each piece an ID from a fixed vocabulary.
For example, a tokenizer might keep a common word such as “the” as one token but split a less common word such as “tokenization” into “token” and “ization” [2]. Spaces and punctuation may be included in a token or represented separately, depending on the tokenizer.
The process has two steps:
- Tokenization: split the input into known pieces.
- Encoding: replace each piece with its numerical token ID.
The model receives those numbers, not the original words [3]. When it generates an answer, a decoder converts the output token IDs back into text.
Google gives a rough English-language estimate of about four characters per token, or roughly 60 to 80 words per 100 tokens [1]. That is an average, not a conversion rule. Code, numbers, names and other languages may produce very different counts.
Why Doesn’t AI Read Whole Words?
A vocabulary containing every possible word would be too large and would still fail on new names, misspellings and invented terms. It would also treat related forms such as “teach,” “teacher” and “teaching” as entirely separate items.
Using only individual characters solves the unknown-word problem, but it creates much longer sequences and gives the model smaller, less meaningful units.
Most documented modern language models use a compromise called subword tokenization [5, 6]. Common words can remain whole, while rare words are divided into reusable pieces. This keeps the vocabulary manageable and allows the system to represent text it has never seen before.
For example, a tokenizer does not need a separate entry for every word ending in “-ing.” It can combine a word stem with a token for that ending.
How Does a Tokenizer Learn the Pieces?
One widely used method is byte pair encoding, or BPE. It became influential in neural language processing after a 2016 paper used subword units to improve translation of rare and unknown words [7].
BPE begins with very small units and repeatedly merges pairs that appear together often:
- Start with characters or bytes.
- Count neighboring pairs in a large text collection.
- Merge the most frequent pair into a new token.
- Count again and repeat until the vocabulary reaches its target size [5].
Frequent words and word parts eventually become single tokens. Rare words remain combinations of smaller tokens.
Modern systems often start from the 256 possible byte values, which means they can represent any digital text without an unknown token [5]. Vocabularies also include special tokens that mark boundaries, roles or the end of a sequence.
BPE is not the only method. WordPiece is associated with BERT-style models, while Unigram and SentencePiece are used by other systems [5, 8]. The exact tokenizer is built separately and then paired with the model. A model must use the same vocabulary and tokenization rules it saw during training [2, 9].
What Happens to Tokens Inside a Language Model?
Once the input becomes token IDs, the model converts each ID into an embedding—a learned list of numbers that represents how the token tends to be used [10].
The model’s layers transform those embeddings while considering relationships among the tokens in the sequence. At the output, the model assigns probabilities to possible next tokens. It selects one, adds it to the sequence and runs the process again [10].
That is why a language model appears to “write” an answer. It does not compose a full paragraph and then reveal it. During inference, it predicts the response step by step.
When you use a trained model, tokenizing your prompt is the first step of inference, the stage the previous guide, What Happens During Training—and What Happens When You Use the Model? Training vs. Inference, separates from training. The next guide, How Does AI Turn Words and Ideas Into Numbers? Embeddings Explained, explains what those lists of numbers capture, and How Does AI Recognize Patterns and Make Predictions? Neural Networks Explained covers how the layers learn patterns.
Are Images and Audio Tokenized Too?
Multimodal models also divide images, audio and video into processable units, often called tokens.
An image model might split an image into square patches and represent each patch as a token. The Vision Transformer research showed that a standard Transformer could classify images by treating image patches as a sequence [11]. Audio may be divided by time or converted into learned units before processing.
Each provider uses its own method. The exact number of tokens for an image or minute of audio can vary by model and resolution. The stable idea is that every type of input must be converted into numerical pieces the model can process.
Why Do Tokens Matter?
Tokens Determine Context Limits
A model’s context window is measured in tokens. It includes more than your latest message: earlier conversation turns, system instructions, uploaded files, tool results and the generated response can all count toward the limit [12].
If the combined input and output exceed that window, the application must reject, shorten, summarize or remove information. Read How Much Can AI Read or Remember at Once? Context Windows Explained for how this affects long conversations and documents.
Tokens Measure Usage and Cost
AI services commonly price developer usage by input and output tokens. Output may be priced differently because generation requires the model to run repeatedly, one token at a time.
Some models also use internal reasoning or “thinking” tokens. Those may count toward the context window and billing even when the user sees only the final answer [12, 13].
Because tokenizers differ, comparing only the price per million tokens can be misleading. The same document may require a different number of tokens on another model. Use the provider’s token-counting tool when an exact budget matters [1, 3, 4].
Tokens Affect Speed
A longer input requires more processing. A longer output requires more generation steps. Reducing unnecessary text can therefore lower both delay and cost.
Languages Are Not Counted Equally
Tokenizers learn their vocabularies from data. Languages that are less represented—or whose writing systems do not match the tokenizer’s common pieces—may require more tokens to express the same meaning.
Research on 2023-era tokenizers found large differences across languages, sometimes making equivalent text much more expensive and reducing how much it could fit into the same context window [14, 15]. Newer tokenizers may improve, but users should still measure rather than assume.
Why Does Tokenization Cause Strange AI Mistakes?
Models work with token pieces, not text exactly as people see it. That creates several weak spots.
Spelling and Letter Counting
A word may be represented by one token even though it contains many letters. The model can learn spelling patterns, but it does not always have direct, reliable access to each character inside a token. That helps explain failures on tasks such as counting repeated letters or rearranging characters [16, 17]. Tokenization is not the only cause, but it is part of the difficulty.
Numbers and Arithmetic
Different tokenizers divide numbers differently. One may split 12,345 into “12,” “345,” while another uses individual digits [18]. Those pieces do not naturally represent place value. Research has found that changing number formatting can improve some models’ arithmetic performance [18]. A calculator remains the safer tool when precision matters.
Unusual Names and New Terms
An uncommon name may break into many small tokens. That increases the chance of misspelling and uses more context than a familiar word.
Glitch Tokens
A token can enter the vocabulary during tokenizer creation but appear rarely in the model’s later training data. Researchers have found under-trained “glitch tokens” that trigger unusual behavior [9]. This is another reminder that the tokenizer and model are trained in separate stages.
Is One Token the Same Across Models?
No. Each model family may have a different vocabulary and set of merge rules. The same sentence can therefore become a different sequence and token count.
A larger vocabulary can represent more common chunks with single tokens, reducing sequence length. Meta reported that Llama 3’s 128,000-token vocabulary encoded text more efficiently than Llama 2’s tokenizer on its benchmarks [19]. But larger vocabularies also require the model to learn representations for more possible tokens.
Never assume that a token count from one service applies to another. Count against the exact model you plan to use.
Will AI Always Use Tokens?
Researchers are exploring systems that process raw bytes or dynamically group bytes instead of relying on a fixed tokenizer. ByT5 showed that byte-level models could compete with token-based models on some tasks and handle noisy text more robustly, although the longer sequences require more computing work [20].
The Byte Latent Transformer later proposed variable-sized byte patches and reported competitive results at research scale [21]. These approaches may reduce some tokenizer problems, but subword tokenization remains standard in widely documented language models.
Practical Takeaways
- Use word-to-token ratios only for rough planning. Count the exact text with the target model’s tool when limits or cost matter.
- Recount when changing models. The same prompt may produce a different token total.
- Remember that everything in the request can count. Instructions, conversation history, files, images, tool results and output share the token budget.
- Trim irrelevant material. Focused input is cheaper and often easier for the model to use well.
- Check multilingual workloads separately. Equivalent text may require substantially different token counts across languages.
- Use purpose-built tools for exact character and arithmetic tasks. Token-based prediction is not a substitute for deterministic calculation.
The Bottom Line
Tokens are the bridge between human-readable information and the numbers a language model can process. A tokenizer divides text into reusable pieces, maps them to IDs and allows the model to generate a response one piece at a time.
That hidden step affects cost, limits, speed, multilingual access and even the kinds of mistakes a model makes. When someone advertises a million-token window or a per-token price, the tokenizer determines what that number means in practice.
Sources
- Understand and count tokens. Google AI for Developers (Gemini API documentation), 2026-10-13, accessed 2026-10-24.
- Tokenizers (LLM Course, Chapter 2). Hugging Face, accessed 2026-10-24.
- tiktoken (README). OpenAI (GitHub repository), accessed 2026-10-24.
- Token counting. Anthropic (Claude Platform Docs), accessed 2026-10-24.
- Tokenization algorithms. Hugging Face (Transformers documentation), accessed 2026-10-24.
- minbpe. Andrej Karpathy (GitHub repository), accessed 2026-10-24.
- Neural Machine Translation of Rare Words with Subword Units. Association for Computational Linguistics (ACL 2016); arXiv, 2016-06-10, accessed 2026-10-24.
- SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing. EMNLP 2018 (system demonstrations); arXiv, 2018-08-19, accessed 2026-10-24.
- Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language Models. EMNLP 2024; arXiv, 2024-09-27, accessed 2026-10-24.
- Attention Is All You Need. arXiv (NeurIPS 2017 paper), 2017-06-12, accessed 2026-10-24.
- An Image is Worth 16×16 Words: Transformers for Image Recognition at Scale. ICLR 2021; arXiv, 2021-06-03, accessed 2026-10-24.
- Context windows. Anthropic (Claude Platform Docs), accessed 2026-10-24.
- Reasoning models. OpenAI (API documentation), accessed 2026-10-24.
- Language Model Tokenizers Introduce Unfairness Between Languages. NeurIPS 2023; arXiv, 2023-10-20, accessed 2026-10-24.
- Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Models. Proceedings of EMNLP 2023 (ACL Anthology), 2023-12, accessed 2026-10-24.
- CUTE: Measuring LLMs' Understanding of Their Tokens. EMNLP 2024; arXiv, 2024-10-02, accessed 2026-10-24.
- Why Do Large Language Models (LLMs) Struggle to Count Letters?. arXiv, 2024-12-19, accessed 2026-10-24.
- Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs. arXiv, 2024-02-22, accessed 2026-10-24.
- Introducing Meta Llama 3: The most capable openly available LLM to date. Meta AI, 2024-04-18, accessed 2026-10-24.
- ByT5: Towards a token-free future with pre-trained byte-to-byte models. Transactions of the ACL (TACL) 2022; arXiv, 2022-03-08, accessed 2026-10-24.
- Byte Latent Transformer: Patches Scale Better Than Tokens. ACL 2025 (Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics, Volume 1: Long Papers); Meta FAIR, 2025-07, accessed 2026-10-24.
