What is a Token in LLMs? How Tokenization Works for GPT, Claude & Gemini
A token is the basic unit of text a large language model reads and generates — roughly 3–4 characters or about ¾ of a word in English. Models don't see words or letters; they see a sequence of token IDs produced by a tokenizer. Tokens drive both pricing (you pay per token) and limits (the context window is measured in tokens). This guide explains what a token is, how tokenization works, and why the same text costs different amounts across GPT, Claude, and Gemini.
Last updated:
Core Concepts
- What a token actually is
- A token is a chunk of text — it might be a whole short word ('the'), part of a longer word ('token' → 'token'), a single character, or even punctuation and whitespace. A tokenizer splits raw text into these chunks and maps each to an integer ID; the model only ever sees that sequence of IDs. As a rule of thumb for English, 1 token ≈ 4 characters ≈ 0.75 words, so 1,000 tokens is roughly 750 words. Code, non-English scripts, and rare words break into more tokens per character.
- Byte-Pair Encoding (BPE) and friends
- Most LLMs use subword tokenization. OpenAI's GPT models use Byte-Pair Encoding (the cl100k_base and o200k_base vocabularies via tiktoken), which starts from bytes and merges the most frequent pairs into larger tokens. This lets the model represent any text — including emoji and unseen words — while keeping common words as single tokens. Google's Gemini uses SentencePiece. Anthropic's Claude uses its own BPE-style vocabulary. Because the merge rules differ, the same sentence tokenizes differently on each.
- Why tokens cost money and cap your prompt
- LLM APIs bill per token — separately for input (your prompt) and output (the completion) — so token count is literally your invoice. Tokens also define the context window: a model with a 128k context window can hold ~128,000 tokens of prompt + response combined. Go over and the API rejects the request or truncates. This is why counting tokens before a call matters for both budget and reliability.
- The same text, different token counts
- A 500-word English article might be ~650 tokens on GPT-4o but a different count on Claude or Gemini — differences of 10–20% are normal because each model family ships its own tokenizer. Non-English text is usually more expensive: languages like Japanese, Arabic, or Hindi often use 2–3× more tokens per character than English because the vocabulary is English-centric. Minified JSON and dense code also tokenize less efficiently than prose.
Frequently Asked Questions
How many tokens is a word?
In English, roughly 0.75 words per token, or about 1.3 tokens per word on average. So 100 words ≈ 130 tokens and 1,000 tokens ≈ 750 words. This varies: short common words are one token, long or rare words split into several, and whitespace/punctuation count too. Use a token counter for an exact figure for your target model.
Do GPT, Claude, and Gemini count tokens the same way?
No. GPT uses tiktoken BPE (cl100k_base / o200k_base), Claude uses its own BPE vocabulary, and Gemini uses SentencePiece. The same text can differ by 10–20% between them, so always estimate against the specific model you're billing on.
Why does my non-English prompt cost more tokens?
Most tokenizer vocabularies are optimized for English, so other scripts fall back to smaller sub-pieces or raw bytes — often 2–3× more tokens per character. A paragraph in Japanese or Arabic can cost noticeably more than the same paragraph in English.
Try these related tools
Token Counter →
Count tokens in your prompt for GPT-4, GPT-3.5, Claude, and Gemini and predict API cost before you spend. Free, no signup — all counting runs locally, your prompt stays in your browser.
Words to Tokens →
Convert words to tokens (and tokens to words) for GPT-4o, Claude, and Gemini. Estimate from a word count or paste text for an exact count with OpenAI's tokenizer. 100% local.
Prompt Token Breakdown →
Break a prompt into segments and see how many tokens — and how much cost — each part uses. Find the heaviest section (system, few-shot examples, or user input) so you know exactly what to trim. 100% local.
Context Window Checker →
Check whether your prompt fits a model's context window before you send it. Estimates prompt tokens, reserves room for the response, and shows remaining headroom across GPT-4o, o1, Claude, Gemini, DeepSeek and more. 100% local.
AI Cost Calculator →
Estimate monthly LLM API cost across GPT-4o, Claude 3.5, Gemini, DeepSeek and 100+ models. Compare providers side-by-side with prompt-caching and batch discounts. Free, no signup — prices refreshed daily from the public LiteLLM catalog.
Embedding Cost Calculator →
Estimate the cost of embedding a corpus — pick a model, enter the number of documents and average tokens each, and get the total token count and dollar cost. 100% local.