A token is a chunk of text that a language model reads and writes one at a time: a short word, part of a longer word, a number fragment, a punctuation mark or a few raw bytes. Providers bill by the million tokens and limit prompts by token count, and on the 14 models read for this guide output tokens cost 5 to 8.3 times as much as input tokens. Prices quoted are a snapshot from 8 November 2026 and will change. On this site's own guides one English word averaged 1.23 tokens, while one Hindi sentence cost 126 tokens in one tokenizer and 38 in another.
Read the script
This is a spoken summary of the guide to tokens. The measured tables, the price comparison and a free caching calculator are on the page.
The short answer. A token is a chunk of text that a language model reads and writes one at a time. It can be a short word, part of a longer word, a number fragment, or a punctuation mark. Providers bill by the million tokens, and they limit prompts by token count.
What a token looks like. Before a model sees your text, a separate program called a tokenizer cuts it into pieces. Two details surprise people. A space belongs to the token that follows it, so you pay for spacing without seeing it. And numbers get chopped up: a price like four dollars fifty six cents became four tokens.
How many tokens is a word? I counted instead of quoting. On the prose of this site's sixty two guides, about a hundred and four thousand words, one English word averaged one point two three tokens. That is roughly twelve hundred and twenty five tokens for a thousand words. It is a rule for English prose, not for code or other languages.
Why not letters or words? Letters make every sentence very long, and long sequences are slow and expensive. Whole words need a vocabulary that is never finished, and they break on names and typos. Subword pieces are the compromise.
Where tokens came from. The method is called byte pair encoding. Philip Gage described it in nineteen ninety four as a file compression trick: repeatedly replace the most common pair of bytes with a new one. In twenty twelve, Google researchers used units smaller than words for Japanese and Korean speech recognition. In twenty fifteen and twenty sixteen, Rico Sennrich and colleagues adapted Gage's idea to build subword vocabularies for neural translation. SentencePiece followed in twenty eighteen, and GPT two moved to bytes, so no text is ever unknown.
How a tokenizer is built. Start with single characters, count every neighbouring pair, merge the most common pair into a new piece, and repeat. On a toy example, newest became a single token while the rarer word widest stayed split in three. Frequent text becomes cheap and rare text becomes expensive.
Real counts. I counted ten kinds of text with two open source OpenAI encodings. English and Spanish cost about twenty tokens per hundred characters. Code and JSON cost about twice as much. The tokenizer can matter more than the language: one Hindi sentence cost a hundred and twenty six tokens in the older encoding and thirty eight in the newer one. Minifying a small JSON sample saved about a third.
Tokens are not a universal unit. Anthropic states that Claude four point seven and later models produce about thirty percent more tokens for the same text. So a lower price per token is not automatically a lower price per page.
What it costs. I read the pricing pages of Anthropic, OpenAI and Google on the eighth of November, twenty twenty six. Output costs five to eight point three times input. The same job, ten thousand requests with three thousand input and five hundred output tokens, ranged from five dollars fifty to five hundred and fifty dollars. That is a hundred times between the cheapest and the dearest. That compares price, not quality.
Context windows. Windows are now around a million tokens, but a bigger window is not free: OpenAI bills the whole request at higher rates over two hundred and seventy two thousand input tokens. And a chat has no memory, so apps resend the whole conversation every turn. In my model, twenty turns billed a hundred and nineteen thousand input tokens for eleven thousand tokens of actual content, ten point eight times as much.
Caching. A cache write costs more than a normal request, and a read costs far less. Break-even is the write multiplier minus one, divided by the write multiplier minus the read multiplier. For a five minute Claude cache that is twenty one point seven percent: if about one request in five finds a live cache, caching pays. The free calculator on the page works it out from your own prices. Prompts below a model's minimum length are not cached at all, and you are not told.
Seven ways to spend fewer tokens: cache the repeated prefix, cap answer length, use a smaller model for easy work, minify structured data, trim tool definitions, summarise old turns, and use batch pricing for work that can wait.
One caution on freshness. None of the three pricing pages carries a last updated date, so treat every price as a snapshot and check the source before you budget.
Key takeaways
- A token is a piece of text chosen by a tokenizer — not a word and not a letter. Short common words are one token; longer or rarer words split into pieces; a space belongs to the token after it; numbers and unusual characters split a lot.
- Measured on this site, one English word is 1.23 tokens — (4.79 characters per token). Code and JSON cost about twice as much per character, and the same sentence in Hindi cost 126 tokens in one tokenizer and 38 in another.
- Models use subword tokens because letters make sequences too long and whole words need an endless vocabulary — The standard method, byte pair encoding, began as 1994 file compression and reached language models through translation work in 2015 and 2016.
- Tokens are the bill and the limit — Prices are per million tokens, output costs 5 to 8.3 times input on the 14 models read for this guide, and context windows are counted in tokens.
- Tokens are not a universal unit — Anthropic states Claude 4.7 and later produce about 30% more tokens for the same text than earlier Claude models, so compare cost per piece of your own text.
- Caching pays once about one request in five is a hit — for a 5- or 30-minute cache; the calculator below finds the break-even for your own numbers.
What a token is
A language model does not read letters or words. Before it sees anything, your text is cut into pieces called
tokens by a separate program, the tokenizer. A token can be a whole short word
(fun), a piece of a longer word (Token and ization), a number fragment, a punctuation mark,
or, for unusual characters, a few raw bytes. The model reads tokens in, and writes tokens out one at a time.
Providers bill by them, and they limit prompts by them.
Two details surprise people. A space belongs to the token that follows it ( fun is one token, with its space), so you pay for
spacing without seeing it. And numbers get chopped up: $4.56 became four tokens, which is why price tables and
logs are expensive to feed into a model. The same word can also be cut differently by different tokenizers, as the last example shows.
Real text, cut into tokens
The older cl100k encoding cuts it differently: un, belie, vably
How many tokens is a word?
Gemini's documentation puts it at about 4 characters per token, and says 100 tokens is about 60 to 80 English words. I counted instead of quoting: the prose of this site's 62 guides (104,577 words, with code, tables and figures removed) came to 1.23 tokens per word, or 4.79 characters per token, using the o200k_base encoding. That is a little more generous than the documentation's range, because these guides use plain, mostly short words. Treat it as a rule for English prose, not for code, numbers or other languages (next sections).
The rule of thumb, measured on 62 guides
Measured on the prose of this site's 62 guides (104,577 words).
Gemini's documentation says about 4.
English prose only. Code and other languages differ.
Why models use tokens instead of letters or words
The model has a fixed list of allowed pieces, its vocabulary, and at every step it scores every entry on that list to decide what comes next. That forces a trade-off, and tokens are the compromise.
| Unit | Vocabulary | Length of a sentence | The catch |
|---|---|---|---|
| Single letters or bytes | Tiny (256 bytes, or a few thousand characters) | Very long | Every step carries almost no meaning, so the model does far more steps and every prompt is huge |
| Whole words | Huge and never finished | Short | Names, typos and new words (“Gunicorn”) have no entry, and every language needs its own enormous list |
| Pieces of words (subwords) | Tens of thousands to a few hundred thousand pieces | In between: about 1.23 tokens per word here | The pieces are learned from text, so common words are cheap and rare ones split into several tokens |
Letters make sequences long, and in the original Transformer design the work of comparing every position with every other grows quickly with
length, so long sequences are slow and expensive. Whole words make sequences short but break on anything the list has not seen. Subword pieces keep the
list a manageable size and still let the model spell out a word it has never met, one piece at a time.
For scale, I measured the vocabularies of three public OpenAI encodings: 50,257 entries for gpt2,
100,277 for cl100k_base and 200,019 for o200k_base.
How tokens were invented
Nobody sat down and designed “the token” for chatbots. The idea was borrowed from data compression, then rediscovered by people who needed machine translation to cope with rare words, and finally scaled up.
| Year | Who | What happened | Why it matters here |
|---|---|---|---|
| 1994 | Philip Gage | Described byte pair encoding in The C Users Journal: repeatedly replace the most common pair of bytes with a new, unused byte. | It was a file-compression trick. Nothing to do with language models yet. |
| 2012 | Mike Schuster and Kaisuke Nakajima | “Japanese and Korean voice search” (ICASSP 2012), the work later called WordPiece, for Google's speech recognition. | Japanese and Korean words are hard to separate, so they needed units smaller than words. |
| 2015 (preprint), 2016 | Rico Sennrich, Barry Haddow and Alexandra Birch | “Neural Machine Translation of Rare Words with Subword Units” adapted Gage's idea to build a subword vocabulary for translation. | This is the step that carried byte pair encoding into neural language work. |
| 2018 | Taku Kudo and John Richardson | SentencePiece (EMNLP 2018): train a tokenizer straight from raw text, with no splitting into words first, and choose the final vocabulary size. | Made one tokenizer work for any language, including ones without spaces. |
| 2019 | OpenAI (GPT-2) | Byte-level byte pair encoding: work on bytes, so any text can be encoded and nothing is ever “unknown”. | Measured here: a 4-byte emoji costs 3 tokens, built from raw bytes. |
| Since | Every major lab | Vocabularies grew: 50,257, then 100,277, then 200,019 entries across three public OpenAI encodings. | A bigger vocabulary packs more text into each token, as the Hindi example below shows. |
The 1994, 2012, 2015/2016 and 2018 entries were checked against paper records during this write-up. The GPT-2 entry rests on my measurement of the
gpt2 encoding in tiktoken (50,257 entries, byte fallback) and my recollection of the GPT-2 paper, which I did not reopen. Which text each tokenizer was trained on is not stated on the pricing pages I read.
How byte pair encoding builds a vocabulary
The method is simple enough to follow by hand:
- Start with single characters (or bytes) as the vocabulary, and mark where each word ends.
- Count every pair of neighbouring pieces across a large amount of text.
- Merge the most common pair into one new piece and add it to the vocabulary.
- Repeat until the vocabulary reaches the size you chose. Real tokenizers do this tens of thousands of times.
I ran it on a toy corpus in the style of the one in the translation paper: low five times, lower twice, newest six times, widest three times. These are the first ten merges the program picked:
| Step | Merge | Pair count |
|---|---|---|
| 1 | e + s → es | 9 |
| 2 | es + t → est | 9 |
| 3 | est + end-of-word → est</w> | 9 |
| 4 | l + o → lo | 7 |
| 5 | lo + w → low | 7 |
| 6 | n + e → ne | 6 |
| 7 | ne + w → new | 6 |
| 8 | new + est</w> → newest</w> | 6 |
| 9 | low + end-of-word → low</w> | 5 |
| 10 | w + i → wi | 3 |
Notice what happens. The ending est is common, so it is merged early and becomes one piece. By step 8, newest is a single token.
widest is rarer, so it ends up as wi + d + est: three tokens. That is the whole idea.
Frequent text becomes cheap and rare text becomes expensive. It is also why the same word can cost different amounts in different tokenizers: each one learned
its merges from different text.
The byte-level version used since GPT-2 starts from bytes instead of letters, so it never meets a character it cannot encode. Unusual characters simply fall back to their raw bytes, which is why one emoji can cost several tokens.
How many tokens is my text? Words, code, JSON and other languages
Token counts depend on what you write. I counted ten kinds of text with two open-source OpenAI encodings. One sample each, so read the pattern, not the decimals:
| Text (one short sample each) | Characters | Tokens, cl100k_base | Tokens, o200k_base | o200k tokens per 100 characters |
|---|---|---|---|---|
| English prose | 190 | 38 | 38 | 20.0 |
| Spanish | 129 | 29 | 24 | 18.6 |
| Hindi | 123 | 126 | 38 | 30.9 |
| Arabic | 103 | 74 | 33 | 32.0 |
| Japanese | 63 | 59 | 43 | 68.3 |
| Python code | 196 | 67 | 69 | 35.2 |
| JSON (pretty) | 190 | 72 | 74 | 38.9 |
| JSON (minified) | 121 | 45 | 48 | 39.7 |
| Numbers | 58 | 30 | 30 | 51.7 |
| Emoji | 33 | 19 | 13 | 39.4 |
Same idea, very different token bills
- English and Spanish are cheap, near 20 tokens per 100 characters in both encodings.
- Code and JSON cost about twice as much per character (34 to 40), because symbols, indentation and short names break into many small tokens.
- The tokenizer can matter more than the language. The Hindi sentence cost 126 tokens in the older encoding and 38 in the newer one, a 3.3× difference for identical text. A bigger vocabulary that has seen more of a language packs it into fewer tokens.
- Minifying JSON saved about a third. The pretty-printed object cost 72 tokens (cl100k) or 74 (o200k); the minified one 45 or 48. Part of the saving is the indentation, which tokenizers charge for.
- Numbers and emoji are token-heavy: 52 tokens per 100 characters for the number sample.
Why tokens are the unit you pay in
Every provider charges per million tokens, with separate prices for input and output, and most add a third, much lower price for cached input. Here are 14 current models from the three big providers, copied from their own pricing pages:
| Model | Input | Output | Cached input (read) | Cache write (shortest) | Output ÷ input |
|---|---|---|---|---|---|
| Claude Fable 5.1 | $10.00 | $50.00 | $0.25 | $12.50 | 5× |
| Claude Opus 5.5 | $4.00 | $20.00 | $0.20 | $5.00 | 5× |
| Claude Sonnet 5.5 | $2.00 | $10.00 | $0.10 | $2.50 | 5× |
| Claude Haiku 5.5 (prompt ≤100K) | $0.10 | $0.50 | $0.01 | $0.125 | 5× |
| Claude Haiku 4.5 | $1.00 | $5.00 | $0.10 | $1.25 | 5× |
| OpenAI GPT-6 Astra | $10.00 | $50.00 | $1.00 | $12.50 | 5× |
| OpenAI GPT-6.1 Sol | $2.00 | $10.00 | $0.10 | $2.50 | 5× |
| OpenAI GPT-6.1 Terra | $1.00 | $5.00 | $0.05 | $1.25 | 5× |
| OpenAI GPT-6 Luna | $0.10 | $0.50 | $0.01 | $0.125 | 5× |
| OpenAI GPT-5.4 mini | $0.75 | $4.50 | $0.075 | not listed | 6× |
| Google Gemini 4 Argon | $2.00 | $10.00 | $0.10 | not listed | 5× |
| Google Gemini 3.8 Flash | $0.75 | $3.75 | $0.075 | not listed | 5× |
| Google Gemini 3.5 Flash-Lite | $0.30 | $2.50 | $0.03 | not listed | 8.3× |
| Google Gemini 3.1 Flash-Lite | $0.25 | $1.50 | $0.025 | not listed | 6× |
- Output costs 5 to 8.3 times input. The ratio is exactly 5× on 11 of the 14 rows, 6× on two and 8.3× on one. A long answer is the expensive part of a request.
- Why output costs more is not stated on any of the pages. A reasonable guess, and only a guess, is that the model produces output one token at a time while it can take input in together.
- Hidden thinking counts as output. Gemini's page labels its output price “including thinking tokens”, so a reasoning model can bill far more output than the answer you see.
- The spread is huge. Between the cheapest and dearest rows the input price differs by 100×. The next figure shows the same job priced on all 14.
- Some prices are about to change. Gemini 4 Argon's listed prices double on 1 December 2026 and Gemini 3.8 Flash's on 1 January 2027, per the Gemini page.
The same job, from $5.50 to $550
Text is not the only thing measured in tokens. Gemini's tokens page says an image up to 384 pixels on both sides counts as 258 tokens, larger images are split into 768-pixel tiles of 258 tokens each, and audio counts as 32 tokens per second, so one minute of audio is 1,920 tokens.
Context windows: how many tokens fit, and what long prompts cost
The context window is the most tokens a model can handle in one request: your prompt, the conversation so far, any documents, and the answer it writes back. Windows are now around a million tokens, but a bigger window is not a free one:
| Model | Context window | Long-prompt rule |
|---|---|---|
| Claude 4.6 and later (not Haiku 5.5) | 1M tokens | Included “at standard pricing” (Anthropic pricing page). |
| Claude Haiku 5.5 | Not stated on the page | Prompts over 100,000 tokens pay higher prices: input rises from $0.10 to $0.50 per million. Cache reads and writes count toward the 100,000. |
| GPT-6.1 Sol and GPT-6.1 Terra | 1,050,000 tokens; up to 922,000 in and 128,000 out | Over 272K input tokens the whole request is billed at 2× input and cached rates and 1.5× output. |
| Gemini 4 Argon | 1,048,576 tokens shared by input, thinking and output | Synchronous output is capped at 65,536 tokens by default. |
The bigger risk is quiet. A chat model has no memory between calls, so apps resend the whole conversation every turn, and you are billed for it every time.
A chat bills its past again every turn
That is why chat products summarise old turns, why agents trim their tool lists (a four-tool server cost about 750 tokens of context before any call), and why coding agents fetch files on demand instead of loading a whole codebase. The remedy for the repeated part is caching.
How caching changes the maths: input, output and cached tokens
Caching is a discount on the part of the prompt you repeat. The mechanics guide explains what is actually stored; here is what it costs, with the provider numbers from their own pages:
| Provider | Cache write | Cache read | Lifetime | Smallest cacheable prompt |
|---|---|---|---|---|
| Claude | 1.25× input for 5 minutes, 2× for 1 hour | 0.1× input; 0.05× on Opus 5.5 and Sonnet 5.5; 0.025× on Fable 5.1 | 5 minutes, refreshed free each time it is used | 512 to 4,096 tokens, by model |
| OpenAI (GPT-5.6 and later) | 1.25× for 30 minutes, 2.5× for 12 hours | 0.1×, or 0.05× on GPT-6.1 Sol and Terra | 30 minutes or 12 hours | 1,024 tokens |
| OpenAI (earlier models) | No write price listed | Cached-input price listed: 0.1× for the GPT-5 family, 0.25× to 0.5× for GPT-4.1 and GPT-4o | Not covered here | Varies by request |
| Gemini (implicit) | No write premium stated; explicit caching adds a storage fee per hour | About 0.05× to 0.1× of the input price | Not stated on the caching page | 2,048 to 4,096 tokens, by model |
A write costs more than a normal request and a read costs far less, so the question is how often you read. Call the write price w and the read price r,
both as multiples of the normal input price, and the share of requests that find a live cache h. The average price of a cached token is
h×r + (1 − h)×w, and caching beats not caching when that is below 1. Solving gives a break-even hit rate of
(w − 1) ÷ (w − r). For a 5-minute Claude cache (w = 1.25, r = 0.1) that is 0.25 ÷ 1.15, or 21.7%.
| Setting | Write w | Read r | Break-even hit rate | Fewest requests in one cache lifetime |
|---|---|---|---|---|
| Claude, 5-min write, 0.1x read (Sonnet 4.6, Haiku 4.5) | 1.25× | 0.1× | 21.7% | 2 |
| Claude Opus 5.5 / Sonnet 5.5, 5-min write | 1.25× | 0.05× | 20.8% | 2 |
| Claude Fable 5.1, 5-min write | 1.25× | 0.025× | 20.4% | 2 |
| Claude, 1-hour write, 0.1x read | 2× | 0.1× | 52.6% | 3 |
| Claude Opus 5.5 / Sonnet 5.5, 1-hour write | 2× | 0.05× | 51.3% | 3 |
| OpenAI GPT-6.1 Sol / Terra, 30-min write | 1.25× | 0.05× | 20.8% | 2 |
| OpenAI GPT-6.1 Sol / Terra, 12-hour write | 2.5× | 0.05× | 61.2% | 3 |
| OpenAI GPT-6 Astra, 30-min write (read 0.1x) | 1.25× | 0.1× | 21.7% | 2 |
- A 5-minute or 30-minute cache pays off once about one request in five is a hit. Two requests inside one lifetime are enough.
- Long caches need more reuse. A 1-hour Claude write (2×) needs about half of requests to hit, and a 12-hour OpenAI write (2.5×) about 61%.
- With no write premium, caching cannot lose. OpenAI's earlier models list no cache-write price and Gemini's implicit caching states none, so any hit saves.
- Short prompts are not cached at all, and you are not told. Anthropic's page says prompts below the minimum “cannot be cached” and no error is returned.
Free caching break-even calculator
Pick a model, describe one typical request, and say how often you expect the cache to still be alive. Everything is calculated in your browser and nothing is sent anywhere. The presets use list prices read on 8 November 2026, which may be out of date by the time you read this. Treat the results as estimates: type in your provider's current prices, or choose “Custom”, and check their page before you budget.
How this is worked out
- Without caching, one request costs
(prefix + changing input) × input price + output × output price. - With caching, each prefix token costs
input price × (hit rate × read + (1 − hit rate) × write). A miss writes the cache again, so it pays the write price. - Break-even hit rate is
(write − 1) ÷ (write − read). If the write multiplier is 1 or less, any hit saves and the tool says so. - Fewest requests per cache lifetime is
(write − read) ÷ (1 − read), rounded up: how many requests inside one lifetime make a single write worthwhile. - Not modelled: batch discounts, long-prompt surcharges, Gemini's hourly storage fee for explicit caches, and prices that change after 8 November 2026.
How to count tokens before you pay
The estimates above are for planning. To know, count. For OpenAI's open-source encodings this takes four lines, and I ran them to produce the numbers in this guide:
import tiktoken
enc = tiktoken.get_encoding("o200k_base")
text = open("prompt.txt").read()
print(len(enc.encode(text)), "tokens (o200k_base)")
Two cautions. The pages I read do not say which encoding each current OpenAI model uses, so treat the count as an estimate for those models. And Claude and Gemini tokenizers are not something you can download from the pages I read: use each provider's own token-counting method in its documentation. In production, log the token usage reported in each API response, which is what you are actually billed on.
Seven ways to spend fewer tokens, ranked by size of effect
In rough order of how much they usually save, each with the evidence behind it:
| What to do | What it saves | Evidence |
|---|---|---|
| Cache the repeated prefix | Cached reads cost 0.025× to 0.1× of normal input | Provider pricing pages; break-even about 21% hit rate for short caches |
| Cap the length of answers | Output costs 5× to 8.3× input | All 14 price rows in this guide |
| Use a smaller model for easy work | Input price differs 100× between the cheapest and dearest rows | Price table above; quality is a separate question |
| Minify structured data you send | About a third fewer tokens on a small JSON sample | Measured: 72 to 45 (cl100k) and 74 to 48 (o200k) tokens |
| Trim tool and schema definitions | Sent as input on every call | A four-tool server was about 2,970 characters, roughly 750 tokens |
| Summarise old conversation turns | Stops the history being rebilled in full each turn | 20 turns billed 10.8× their new content in the model above |
| Use batch or flex pricing for work that can wait | Half the standard price on OpenAI | OpenAI pricing page: Batch and Flex are 50% below Standard |
The first three change the unit price or the volume of the biggest line, which is why they come first. Everything else is smaller, but the JSON and tool-list changes are free.
Documented vs. inferred vs. unsupported
| Claim | Status | Basis |
|---|---|---|
| Providers bill per token, with separate input and output prices | Documented | All three pricing pages. |
| Output costs 5 to 8.3 times input on the 14 rows listed | Documented | Arithmetic on the prices in the table, read 8 November 2026. |
| Byte pair encoding was described by Gage in 1994 and adapted for neural translation by Sennrich and colleagues | Documented | Paper records checked during this write-up. |
| English prose averages about 1.23 tokens per word | Measured | 62 guides on this site, o200k_base. Not a rule for code or other languages. |
| The same text gives the same token count on every model | Unsupported | Two OpenAI encodings differ on identical text (Hindi 126 vs 38 tokens), and Anthropic says Claude 4.7+ produces about 30% more tokens than earlier Claude. |
| A bigger context window means you should fill it | Unsupported | OpenAI bills the whole request at higher rates over 272K input tokens and Haiku 5.5 over 100K. |
| Caching always saves money | Unsupported | Below about 21% hit rate a 5-minute cache costs more; a 1-hour write needs about 51%. |
| Output costs more because generating is sequential | Inferred | No provider page gives a reason. This is a common explanation, not a stated one. |
| The tokenizers of the newest GPT, Claude and Gemini models are public | Not stated | Not stated on the pricing pages read for this guide. |