How this LLM token counter works
Language models do not read characters or words. They read tokens: fragments of text drawn from a fixed vocabulary, where a common word is often one token and a rare word is several. Providers bill by the token, and a model’s context window is measured in tokens too, so the token count of a prompt decides both what a call costs and whether it fits.
The counter runs a real byte-pair-encoding tokenizer, not a length-divided-by-four guess. It loads OpenAI’s o200k_base encoding through js-tiktoken in a background thread, so a large document does not freeze the page. For the GPT-4o and GPT-4.1 families that count is exactly what the API bills. For every other model the table shows the same count with a ≈ sign.
Why token counts differ between models
Each model family trains its own tokenizer, so the same sentence can be split into more or fewer pieces depending on the vocabulary. The difference is not small: Anthropic states that Claude models from 4.7 onward produce roughly 30% more tokens than earlier Claude models for the same text, and non-English text, source code and long numbers all tokenize less efficiently than plain English prose.
That is why a cost comparison based on one shared token count is an approximation. It is still the right first step for choosing a model, because price differences between models are usually far larger than tokenizer differences — but before you set a budget, send a representative prompt to the real API and read the usage figures it returns.
Reading the cost table
Every row prices your prompt as input tokens and your expected reply as output tokens at that model’s per-million-token rates. Output is usually several times more expensive than input, so a short prompt that produces a long answer can cost more than a long prompt with a short answer. The cheapest model for your inputs is highlighted, and a red warning appears when the prompt is longer than a model’s context window.
Tick “Prompt is served from cache” to price the input at each provider’s cache-read rate, which is commonly a 50–90% discount on repeated prefixes. Set calls per day to turn the per-call price into a monthly figure, and use “Copy as markdown table” to paste the comparison, with its source line, into a design document or pull request.
Limits of this calculator
- Estimated counts (≈) can differ from what the provider bills, in either direction.
- Prices are standard-tier list prices for prompts up to 200k tokens; batch discounts, long-context surcharges, regional multipliers and fast-mode premiums are not modelled.
- Cache writes, tool-use overhead, images and reasoning tokens are not included.
- Prices change. The verification date is shown, and each provider’s page is the source of truth.
How to use it
- Paste your prompt into the box, or drop a .txt or .md file on it.
- Set the expected output length and how many calls you make per day.
- Compare the cost per call and per month across models; the cheapest is highlighted.
- Tick the cache option if your prompt prefix is reused, then copy the table if you need it elsewhere.
Frequently asked questions
Are these token counts exact?
They are exact for OpenAI models that use the o200k_base encoding, such as GPT-4o and GPT-4.1, because the tokenizer is run in your browser. For other models the provider’s own tokenizer cannot be run in a browser, so the count is an estimate made with o200k_base and marked with ≈. Treat an estimate as a planning figure and check the usage field of a real API response before you commit to a budget.
Why does the same text give different token counts on different models?
Each model family has its own vocabulary of text fragments, and text is split into the longest fragments the vocabulary knows. A larger or differently trained vocabulary splits the same sentence into a different number of pieces. Anthropic, for example, states that its 4.7 and later models produce roughly 30% more tokens for the same text than earlier Claude models.
Is my prompt sent to a server?
No. Counting runs in a background thread in your browser. The site records only an anonymous counter such as how many models were compared, never the text you paste.
How current are the prices?
Prices were last verified on September 24, 2026 against the providers’ own pricing pages, and the date is shown next to every table. They can change without notice, so confirm a price on the provider’s page before signing a contract or setting a budget.
What does the cached-input option do?
Providers charge a much lower price for prompt text that they can serve from a cache, typically when the same long prefix is sent repeatedly. Ticking the option prices the input at each model’s cache-read rate where one is listed. Cache write charges and cache expiry are not modelled.
What is a token, roughly, in words?
A common rule of thumb for English is about four characters, or three quarters of a word, per token. Code, other languages and unusual formatting usually use more tokens per word, which is why counting the real text beats using the rule.
Prices verified September 24, 2026 from the providers’ pricing pages. Estimates are marked ≈. Always check the provider’s current price and the usage field of a real API response before budgeting.