By Plainly Editorial

Updated

First published

What are tokens in AI?

Filed under AI & modern tech

What is a token, exactly?

A language model cannot read letters the way you do. Before any text reaches the model, a program called a tokenizer chops it into pieces and swaps each piece for an ID number from a fixed vocabulary. The model only ever sees those numbers. Its answer comes back as numbers too, which are turned back into text.

A token can be a whole word (“cat”), part of a word (“token” + “ization”), a single character, a space attached to a word, or a punctuation mark. Common words are usually one token. Rare words, names, and typos get split into several.

For example, a sentence like “Tokenization isn't hard.” might become something like “Token”, “ization”, “ isn”, “'t”, “ hard”, “.” The exact split depends on the model, because each model family has its own tokenizer.

How does tokenization work?

Most modern tokenizers use a method called byte pair encoding (BPE) or a close relative. The idea is borrowed from data compression and was adapted for language models in a 2015 paper by Sennrich and colleagues.

BPE starts with the smallest units, individual characters or bytes. It then scans a large sample of text, finds the pair of units that appears together most often, and merges them into a new unit. It repeats this tens of thousands of times. Frequent sequences like “the”, “ing”, and “ation” end up as single tokens, while rare sequences stay split into smaller pieces.

The result is a vocabulary that is typically tens of thousands to a few hundred thousand tokens. It is a compromise: whole-word vocabularies would be enormous and could not handle new words, while character-by-character text would make every input very long. Subword tokens can spell out any word, even one the model has never seen.

How many tokens is a word?

For ordinary English prose, useful rules of thumb from OpenAI's documentation are: one token is about four characters, about three-quarters of a word, and 100 tokens is about 75 words. Flip that around and 1,000 English words is roughly 1,300 to 1,400 tokens.

These are averages. Short common words like “the” or “and” are one token each. A long technical term like “electroencephalography” may be four or five. Numbers, URLs, and unusual names tend to break into many small pieces.

Different model families produce different counts for the same text, sometimes differing by 10 to 20 percent or more. If you need an exact count, use the provider's own tool: OpenAI offers a tokenizer page and the tiktoken library, and Anthropic offers a token counting API endpoint.

Why do non-English text and code use more tokens?

Tokenizers learn their merges from training text, and that text has historically been dominated by English. English words therefore get compact, efficient tokens. Languages with less training data, or with different scripts, get split into smaller fragments.

A 2023 NeurIPS paper by Petrov and colleagues measured this across 17 tokenizers and found that the same text translated into different languages could vary in token length by up to 15 times. Since APIs charge per token, that can mean speakers of some languages pay several times more for the same task. Newer tokenizers have narrowed the gap for major languages, but it has not disappeared.

Code is often token-heavy too. Indentation, brackets, symbols, and variable names like getUserAccountId all break into multiple tokens. Structured data like JSON, with its quotes, colons, and repeated keys, can use noticeably more tokens than the same information written as plain sentences.

How do tokens affect AI pricing?

AI APIs bill by the token, usually quoted as a price per million tokens. Input tokens are what you send: your prompt, the system instructions, any documents you attach, and the earlier messages in a conversation. Output tokens are what the model writes back.

Output tokens almost always cost more than input tokens, often several times more, because generating text one token at a time takes more computing work than reading it. Some providers also offer a lower rate for cached input, which is text you send repeatedly, such as a long fixed set of instructions.

Reasoning models add a wrinkle. When a model “thinks” before answering, those hidden reasoning tokens are typically billed as output tokens even if you never see them. A short visible answer can still use thousands of output tokens behind the scenes.

What do tokens have to do with context windows?

A context window is the maximum number of tokens a model can handle at once, counting both what goes in and what comes out. Everything has to fit: system prompt, conversation history, attached files, and the reply.

As of late 2026, leading models commonly offer context windows in the hundreds of thousands of tokens, and some support a million or more. That is enough for several long books in a single request. Smaller and older models may have much smaller limits.

In long chat conversations, every new message usually resends the earlier history, so the input token count grows with each turn. That is why a long chat can get slower and more expensive, and why some apps quietly summarize or drop older messages.

Output length is usually capped separately. Many APIs let you set a maximum number of output tokens per reply, and models also have a built-in ceiling on how much they can write in one response. If an answer stops mid-sentence, it has often hit that output limit rather than run out of things to say.

Approximate token counts for common English text (typical tokenizers; actual counts vary by model)

TextApproximate wordsApproximate tokens
A single short word11
A full-length tweet (280 characters)45–5560–75
A typical email150–200200–270
One single-spaced page500650–700
A 1,000-word blog post1,0001,300–1,400
A 20-page report10,00013,000–14,000
An average novel80,000–100,000105,000–135,000
  • The word “hello” is usually a single token, while “Supercalifragilisticexpialidocious” splits into many.
  • A 1,000-word English article comes out at roughly 1,300 to 1,400 tokens with common tokenizers.
  • The same paragraph translated into Hindi or Burmese can use two or more times as many tokens as the English version, depending on the tokenizer.
  • A chatbot conversation with 30 back-and-forth turns can resend tens of thousands of input tokens with each new message.
  • Asking a reasoning model a tricky maths question can use thousands of hidden reasoning tokens that are billed as output.

Common questions

Why can't AI count the letters in a word?

Because the model sees tokens, not letters. A word like “strawberry” might reach the model as two or three tokens, so it never directly sees each “r”. It has to infer spelling from patterns it learned, which often works but can fail. Asking it to spell the word out letter by letter first usually helps.

Are spaces and punctuation counted as tokens?

Yes. Punctuation marks are often their own tokens, and spaces are usually attached to the start of the following word, so “ hello” with a leading space is a different token from “hello” without one. Extra blank lines, tabs, and repeated spaces all add to your token count.

Do images and PDFs use tokens?

Yes. Models that accept images convert them into tokens too, and the count usually depends on the image's size and resolution. PDFs are typically converted to text, and sometimes page images, before processing. Providers document how they count these, and their token counting tools can measure an attachment before you send it.

Is a token the same in every AI model?

No. Each model family uses its own tokenizer with its own vocabulary, and a provider may change tokenizers between model generations. The same sentence can produce different counts in GPT, Claude, Gemini, or Llama models. Rules of thumb are fine for estimates, but use the provider's counter for budgeting.

What is the difference between tokens and embeddings?

A token is a chunk of text with an ID number. An embedding is a long list of numbers that represents meaning. Inside a model, each token ID is first turned into an embedding so the model can work with it mathematically. Separately, whole sentences or documents can be embedded to power semantic search and RAG.

How can I reduce my token usage?

Trim long instructions and remove repeated boilerplate, send only the relevant parts of documents rather than whole files, ask for concise answers or set a maximum output length, start fresh conversations instead of letting history pile up, and use prompt caching where the provider supports it for text you send repeatedly.

Sources and further reading

  1. What are tokens and how to count them? — OpenAI Help Center
  2. Token counting — Anthropic (Claude Docs)
  3. Neural Machine Translation of Rare Words with Subword Units (Sennrich et al., 2015) — arXiv
  4. Language Model Tokenizers Introduce Unfairness Between Languages (Petrov et al., 2023) — arXiv

Glossary terms

Keep reading