For English prose, one token is about 4 characters or about three-quarters of a word, so a characters to tokens calculator that divides your character count by four gives a fair first estimate. Google gives the same figure for Gemini: about 4 characters per token, with 100 tokens equal to roughly 60 to 80 English words. That estimate holds for English prose, not for everything else. Source code, JSON, numbers, non-Latin scripts and emoji all convert at their own rates, and across seven measured samples the characters-per-token ratio spans almost a factor of five. Anything you will be billed for needs a count from the model’s own tokeniser.
How a Characters to Tokens Calculator Gets Its Number
The common rule of thumb is a single ratio: tokens ≈ characters ÷ 4. The ratio comes from how byte pair encoding (BPE) builds its vocabulary. BPE starts from individual characters and repeatedly merges the most frequent pairs in a training corpus into subword units. On English training text, those merges settle on units that average about four characters. Modern tokenisers such as o200k_base, cl100k_base and Claude’s attach a space to the word that follows it, so spaces add very little to the count and the four-character rule already accounts for them.
The problem is that the divisor of four fits ordinary English prose, not text in general. OpenAI’s own help page says these figures are estimates rather than exact counts, and that other languages have different relationships between characters, words and tokens.
Worked Example: The Same 12,000 Characters, Three Ways
Assume a 12,000-character input and use the characters-per-token ratios measured with tiktoken by johal.in: 4.54 for English prose, 2.10 for pretty-printed JSON and 0.93 for Chinese.
| Content (12,000 characters) | Measured chars per token | Tokens (12,000 ÷ ratio) | What chars÷4 would have predicted |
|---|---|---|---|
| English prose | 4.54 | about 2,640 | 3,000 |
| Pretty-printed JSON | 2.10 | about 5,710 | 3,000 |
| Chinese text | 0.93 | about 12,900 | 3,000 |
The chars÷4 estimate is slightly pessimistic for the prose, underestimates the JSON by nearly half and misses the Chinese by a factor of about four. Those ratios come from OpenAI encodings, so the absolute counts belong to those vocabularies and carry over to other models only in shape.
How Many Characters Are in a Token of English, and How Many Tokens per Word?
For English prose, the usual word-level figure is about 1.33 tokens per word, which the converter site Calcis reports as stable across o200k_base, cl100k_base, Claude’s tokeniser and Google’s SentencePiece. Common words such as “the” and “and” are single tokens, while rarer or longer words split into two or three pieces (see an example of tokenization), and that long tail averages out to about four tokens per three words. A measured run by TextKit found 110 tokens for a 94-word English passage on GPT-5: about 1.17 tokens per word, or about 0.85 words per token, close to the “0.75 words per token” rule.
Anthropic’s own figures for Claude differ from Calcis’s. Anthropic’s glossary says that on models before Claude 4.7, a token represents about 3.5 English characters, and that Claude 4.7 and later use a newer tokeniser producing about 30% more tokens for the same text. Fast.io puts English prose on the newer Claude tokeniser at roughly 1.3 to 1.5 tokens per word, against about 1.0 to 1.3 on older models. If you are estimating for Claude specifically, a divisor of four is optimistic. For the word-based view in more depth, our page on average tokens per word covers how those ratios feed into cost.
Why Do Code, Non-English Text and Emoji Produce More Tokens per Character?
Each of these content types contains character sequences the tokeniser’s vocabulary compresses poorly, so it falls back to smaller pieces. The johal.in measurements give the clearest single picture: an 8,192-token window holds 37,152 characters of English prose, 33,972 of Python, 17,231 of formatted JSON and 7,592 of Chinese.
| Content type | What fragments it | Measured or reported ratio |
|---|---|---|
| Source code | Punctuation, indentation and identifiers missing from the vocabulary (“useQuery”, “init”) | About 3 chars per token on Calcis’s estimate; johal.in measured Python at 4.15, so code ratios vary by language |
| JSON | Quotes, braces, colons and indentation tokenised separately | 2.10 chars per token pretty-printed, so minified JSON is cheaper |
| Numbers and digits | Digit sequences split unpredictably; a year such as “2024” can be four tokens | 2.76 chars per token for a numeric sample |
| CSV numeric data | Dates, IDs, decimals and percent signs tokenise one fragment at a time | 57 tokens per 100 characters, three times the density of English prose |
| URLs | Slashes, dots, hex strings, query parameters | 2.53 chars per token |
| CJK scripts | Characters often take one to two tokens each | About 1 to 1.5 chars per token; 0.93 measured for Chinese |
| Emoji | Each emoji is one to three tokens on o200k; skin-tone and compound variants cost more | Per-character density between prose and code in a social-media sample |
Tokeniser training objectives are frequency based, so they favour the languages that dominate the training data and leave lower-resource languages with disproportionately longer tokenisations. Petrov and colleagues found that the same text translated into different languages can differ in tokenised length by up to 15 times. Ahia and colleagues (EMNLP 2023) make the commercial point: vendors charge per token, and the number of tokens needed to convey the same information varies widely by language.
The penalty is also a property of the tokeniser version, not only the language. On johal.in’s sample, the same Hindi sentence was 111 tokens under cl100k_base and 28 under o200k_base. TextKit measured a Spanish passage at 222 tokens on the GPT-3-era encoding, 172 on GPT-4’s and 143 on GPT-5’s, as o200k doubled the vocabulary to around 200,000 tokens and gave far more of it to non-English text. Even on GPT-5, the same passage still cost 30% more tokens in Spanish and 86% more in Japanese than in English.
Getting an Exact Count for OpenAI, Claude and Gemini Instead of Estimating
An exact count comes from the model’s tokeniser library or the provider’s token counting endpoint. Tokenisers differ by family: GPT-4 and GPT-3.5-Turbo use cl100k_base, GPT-4o, the o-series and the GPT-5 family use o200k_base, Claude’s tokeniser has no public encoder, and Gemini uses a proprietary SentencePiece vocabulary of about 256,000 tokens.
OpenAI. tiktoken is OpenAI’s open-source tokeniser; given a string and an encoding, it returns the token list. OpenAI’s help page recommends selecting the encoding for your target model with tiktoken.encoding_for_model(model). The measurement takes a few lines of Python and needs no model or GPU:
import tiktoken
enc = tiktoken.encoding_for_model("gpt-4o")
text = open("document.txt", encoding="utf-8").read()
n = len(enc.encode(text))
print(len(text), "chars", n, "tokens", round(len(text) / n, 2), "chars per token")
A plain-text count is not necessarily the whole request, though. Message structure, tools, schemas, images and files all affect the full input count. OpenAI’s input-token counting API accepts messages, images, files, tools and conversations, and returns the exact count including the formatting tokens for roles and message boundaries. An input count says nothing about how many tokens the model will generate. For images and files, OpenAI says estimates such as characters ÷ 4 are inaccurate, and tools and schemas add tokens that are hard to count locally. Our guide to counting tokens with tiktoken goes further into the message-formatting overhead.
Claude. Anthropic provides a pre-flight endpoint: POST to /v1/messages/count_tokens with the same payload you would send to the Messages API, and the response gives the input tokens that request would consume. Anthropic’s guidance is to count with the model ID you plan to use, because the count depends on the model’s tokeniser, the language and the content type.
Gemini. Exact counts come from the provider’s countTokens endpoint, as they do for Anthropic. Everything sent to the Gemini API is tokenised, including images and other non-text input, and system instructions and tools count toward input tokens.
Open-weight models. Use the model’s own tokeniser, for example AutoTokenizer.from_pretrained on the model’s repository or the tokeniser bundled with a GGUF file; counting with a different vocabulary gives a number that is confidently wrong.
How Many Characters Fit in a 200k-Token Context Window?
At chars÷4, a 200,000-token window holds about 800,000 characters of English prose, but the real figure depends heavily on what the text is. Scaling the johal.in 8,192-token capacities to 200,000 tokens (characters held ÷ 8,192 × 200,000) gives the following, with the same caveat that these are OpenAI encodings:
| Content | Chars per token (from the 8,192-token test) | Approximate characters in 200,000 tokens |
|---|---|---|
| English prose | 4.54 | about 907,000 |
| Python | 4.15 | about 829,000 |
| Formatted JSON | 2.10 | about 421,000 |
| Chinese | 0.93 | about 185,000 |
Three things shrink those numbers in practice. First, the window is shared: for a text generation model, the prompt and the generated output together must fit inside the maximum context length. On Claude, the system prompt, every message including tool results and documents, the tool definitions and the output with any extended thinking all count toward the window. Second, on Claude 4.7 and later the newer tokeniser produces about 30% more tokens for the same text, so the same window holds correspondingly less. Third, filling a window is not the same as using it well: Anthropic notes that accuracy and recall degrade as token count grows, which it calls context rot.
Context windows themselves vary; Anthropic describes Claude’s as up to 1M tokens depending on the model. Our judgement is to leave room in the window for instructions, retrieved material and output, and to confirm the actual fit with the token counting API before relying on it.
How Token Counts Become Inference Cost and Latency in a Production Feature
Cost
Per-request cost follows token count: input tokens times the input rate plus output tokens times the output rate. Anthropic bills uncached input, cache writes, cache reads and output separately, then applies any batch or regional multiplier. Output is the expensive side: on current Claude models it is priced at 5 times input, and across providers output runs about 3 to 6 times input. A verbose response therefore costs more than a prompt of the same token count.
Because billing is per token, a tokeniser change is a price change. Sentra’s worked example: Sonnet 4.6 at $3 per million input tokens against Sonnet 5 at $2 is a 33% cut on paper, but a 100,000-character prompt that counts about 25,000 tokens on the older model counts about 32,500 on the newer one, so the saving is 13% rather than 33%. The same logic applies across vendors. Measured with each vendor’s production tokeniser, Claude’s newer tokeniser produced 1.36 to 1.42 times as many tokens as GPT’s o200k on prose, HTML and JSON, and 1.50 to 1.73 times on code. A price per million tokens is not comparable between vendors until you know how many tokens each turns your text into.
Production bills also grow through tokens that a single-text count misses:
- Conversation history. Every turn resends the whole history, so token spend on a long agent session grows quadratically rather than linearly.
- Retrieval. A RAG pipeline that pastes ten documents into context pays for all ten on every turn, relevant or not.
- Prompt examples. In one classification study, adding few-shot examples roughly doubled average input tokens (GPT-4o: 333 to 611; Claude: 367 to 682), with higher cost and worse latency tails.
- Invisible output. Reported output tokens include reasoning tokens and, on some models including GPT-5, formatting tokens for response channels and tool calls that never appear in the visible text.
OpenAI’s advice is to compare models on the total tokens and cost needed to complete a representative task, since a lower price per million tokens does not guarantee a lower total cost. For a per-request breakdown you can fill in with your own numbers, see our page on estimating inference cost per request.
Latency
End-to-end latency decomposes as time to first token plus (output tokens − 1) times time per output token: TTFT + (n − 1) × TPOT. With a 300 ms TTFT and a 30 ms TPOT, a 500-token response still takes over 15 seconds. That is why output length dominates. OpenAI’s heuristic is that cutting 50% of output tokens may cut about 50% of latency, while cutting 50% of the prompt may improve latency by only 1-5%.
Input tokens also cost memory beyond the bill, which matters for teams serving AI features in production SaaS: the KV cache is allocated per token, so text that tokenises to four times as many tokens occupies four times as much cache at the same nominal context length. Throughput figures need the same care as prices: tokens-per-second numbers are not always comparable across models because tokenisation differs, and Anyscale found Llama 2 tokenisation 19% longer than ChatGPT’s.
Measure Your Ratio Once per Content Type and per Model
The single most useful number is your own: count a sample of the text you actually send with the target model’s tokeniser, divide characters by tokens and keep the result, because a ratio measured on your input beats any universal rule. In our view, the sample should be split by content type (prose, code, structured payloads, each language you serve), since a blended average hides the slice that will truncate first or cost most. Treat every model migration as a reason to re-measure; Anthropic’s own guidance is to budget a migration from measured counts on the old and new model, never from the headline rate. Chars÷4 is fine for a first estimate of scale, but a budget needs measured counts.
FAQ
Why Do Language Models Use Tokens Instead of Words?
Subword tokens let a fixed vocabulary represent any text, including rare words and typos, by breaking unfamiliar strings into known pieces. A word-level vocabulary would have no entry for words it never saw in training.
How Many Tokens Is a One-Page Document?
A page of about 3,000 characters is roughly 750 tokens, or a 500-word page about 665 tokens, for English prose. Our page on how many tokens per page works through longer documents.
Does GPT-5.6 Use More Tokens than Earlier GPT-5 Models?
Not on input text: PlayCode checked live API usage for GPT-5.1, GPT-5.5 and GPT-5.6 Sol against a local count and all three matched o200k_base exactly. Total task tokens can still differ, because output and reasoning length vary by model.