How many tokens is a word?
It depends on the language and the kind of text. We ran the same short paragraph, in three languages, plus a small code snippet through the o200k_base tokenizer:
| Sample | Characters | Words | Tokens | Tokens per 100 words |
|---|---|---|---|---|
| English prose | 304 | 54 | 62 | 115 |
| Portuguese prose | 334 | 55 | 72 | 131 |
| Spanish prose | 372 | 64 | 76 | 119 |
| TypeScript code | 231 | 32 | 72 | 225 |
In English, 1,000 words came to about 1,148 tokens. The Portuguese version needed 16% more tokens, and code packs symbols and punctuation that each cost tokens. Always count real samples of your own content before budgeting.
Why models count tokens differently
Every provider trains its own tokenizer, so the same text can be a different number of tokens on different models. This counter uses o200k_base, the open-source encoding used by OpenAI’s GPT-5, GPT-4.1 and GPT-4o models. Anthropic notes that its tokenizer for Claude Opus 4.7 and later produces roughly 30% more tokens than the one used by earlier Claude models. That is why identical per-token prices can still lead to different bills.
Get exact counts from each provider
- OpenAI: the input token count endpoint returns the exact count for a request, including formatting tokens for message roles that local tokenizers don’t see. Locally, use tiktoken or gpt-tokenizer.
- Anthropic: the token counting API counts tokens for a Claude message before you send it.
- Google: the Gemini API’s countTokens method counts tokens for Gemini models.
How to spend fewer tokens
- Trim repeated context. System prompts and chat history are re-sent on every request; shorter instructions save tokens on every call.
- Use prompt caching. Cached input usually costs about 10% of the normal input price — see each model’s cached rate on the model pages.
- Cap the output. Output tokens cost several times more than input, so ask for concise answers and set a maximum output length.
- Match the model to the job. Compare prices and benchmark scores on the benchmarks page, then estimate a full month in the cost calculator.