LLM Token Counter & API Cost Calculator

Paste a prompt to count its tokens for GPT, Claude, Gemini and Mistral models, then see what it would cost per request, per day and per month — and whether it fits each model's context window.

Your text never leaves this browser

Counting and cost calculations run entirely on this device. Nothing you paste is uploaded, logged or sent to OpenAI, Anthropic, Google or anyone else. The only download is OpenAI's tokenizer file (about 2 MB), fetched from this site the first time you type.

Tokens · 0
Characters 0
Words 0

Cost calculator

Per request $0.00
Per day $0.00
Per month (30 days) $0.00

All models, cheapest first

Each model is costed on its own token count for your text, because the same words come to a different number of tokens on each provider's tokenizer. Context used is the share of the model's context window your input takes.

Model Input tokens Price per 1M (in / out) Per request Per day Per month Context used

Prices last checked:

Standard-tier prices in US dollars, before prompt-caching, batch or regional adjustments. Prices change often — confirm them on the provider's own pricing page before you budget.

What a Token Is

Language models do not read letters or whole words. Before a model sees your prompt, a tokenizer cuts the text into tokens: common words become a single token, rarer words are split into pieces, and punctuation and spaces are folded in along the way. Everything about using a model through an API is measured in these units — the price, the rate limits, the maximum response length and the size of the context window.

A worked example, using the o200k_base tokenizer that OpenAI's GPT-5 models use. The 37-character sentence below comes to 7 tokens. Notice that the leading space belongs to the word that follows it, and that the less common word is split in two:

Tokenization splits text into pieces.
[Token][ization][ splits][ text][ into][ pieces][.]   → 7 tokens

The same tokenizer splits "unbelievably" into three tokens (un · bel · ievably) and turns the 25-character JSON snippet {"id": 42, "name": "Ada"} into 12 tokens, because every brace, quote and colon costs something. Use the "Show how GPT splits this text into tokens" button above to see the split for your own text.

Why Token Counts Differ Between Models

Each provider trains its own tokenizer, with its own vocabulary of text pieces, so the same prompt comes to a different number of tokens on each one. The differences are not small. Anthropic says the tokenizer introduced with Claude Opus 4.7 produces approximately 30% more tokens for the same text than the one before it, and its own figures put the current tokenizer at about 2.5 characters per token, against roughly 4 for OpenAI and Google.

That is why comparing price-per-million-tokens alone can mislead: a model with a lower rate can still cost more for your prompt if it needs more tokens to represent it. The comparison table above costs every model on its own count for exactly that reason.

The kind of text matters as much as the model. English prose is the most efficient case. Source code, JSON, long numbers, URLs and random identifiers need more tokens per character, and so do most other languages: the 45-character Spanish sentence "El tokenizador divide el texto en fragmentos." takes 10 tokens on o200k_base, while "The tokenizer splits the text into fragments.", also 45 characters, takes 8.

Exact Counts and Estimates on This Page

OpenAI publishes its tokenizers, and its official tiktoken library maps GPT-5-family models to the o200k_base encoding. This page runs that encoding in your browser, so counts for the GPT-5.6 models and GPT-5.4 mini are exact and are marked that way. OpenAI has not published which encoding GPT-6 uses, so GPT-6 figures use the o200k_base count and are marked as estimates.

Anthropic, Google and Mistral count tokens on their servers and publish no tokenizer that can run in a browser. Getting an exact count from them would mean sending your text to their API, which this page never does. Instead it applies each provider's own published ratio — about 2.5 characters per token for current Claude models, 4 for Claude Haiku 4.5 and for Gemini — and labels the result as an estimate. Mistral publishes no ratio, so its estimate uses the 4-characters-per-token figure the other providers give for English. For a billing-grade number, use the provider's token-counting endpoint or the usage figures returned with each response.

How to Estimate API Costs

Every provider bills input and output tokens separately, at different rates quoted per million tokens. The cost of one request is:

cost = input tokens × input price ÷ 1,000,000
     + output tokens × output price ÷ 1,000,000

For example, a model priced at $1 per million input tokens and $5 per million output tokens, sent a 1,500-token prompt that gets a 300-token reply, costs $0.0015 + $0.0015 = $0.003 per request. At 10,000 requests a day that is $30 a day, or about $900 over 30 days. Output was a sixth of the tokens but half of the bill.

Count everything that goes into the request, not just the user's question: the system prompt, conversation history resent on every turn, retrieved documents, and tool or function definitions all count as input. On reasoning models, the hidden thinking tokens are billed as output. And watch for long-context pricing: some models charge a higher rate for the whole request once the input passes a threshold — the table above applies it automatically.

How to Reduce API Costs

  • Trim the prompt. Remove repeated instructions, examples the model no longer needs, and conversation turns that no longer matter. Summarise long histories instead of resending them, and send only the retrieved passages that are relevant rather than whole documents.
  • Use prompt caching. When many requests share the same long prefix — a system prompt, a policy document, a codebase — put it first and let the provider cache it. Cache hits are billed at a small fraction of the normal input price — typically a tenth or less — although writing to the cache can cost more than a normal request.
  • Batch work that can wait. OpenAI, Anthropic and Google all price batch requests at half their standard rate in exchange for results arriving within hours rather than seconds. Nightly classification, evaluations and bulk summaries rarely need an instant answer.
  • Use a smaller model for simple tasks. Classification, extraction, routing and short rewrites seldom need a flagship model. The cheapest and most expensive models in the table differ in price by more than a hundred times, so test the small model first and move up only where the quality is not good enough.
  • Cap and shape the output. Output tokens cost several times more than input tokens. Set a maximum output length, ask for concise answers or structured output such as JSON instead of prose, and keep reasoning effort low for easy requests.

Related Tools

Structured output and tool definitions are JSON, and every brace and quote is a token. Validate and minify it with the JSON Formatter.

Pulling fields out of a model's reply, or stripping boilerplate from text before you send it, is often a job for a regular expression. Build and test one with the Regex Tester.

Trimming a long system prompt is easier when you can see exactly what changed between versions. Compare them with the Diff Checker.

Images and files sent to vision models are often Base64-encoded, which makes them about a third larger than the original bytes. Encode and decode them with the Base64 Encoder.

References

Frequently Asked Questions

How many tokens is 1,000 words?

For English prose, usually between about 1,100 and 1,800 tokens, depending on the model and the text. The common rule of thumb of 0.75 words per token gives about 1,330. Google says 100 Gemini tokens are about 60 to 80 English words, which is 1,250 to 1,670 tokens. Anthropic's figures put Claude Opus 4.7 and later at roughly 1,800 tokens per 1,000 words. Simple prose comes in lower: a 1,080-word sample measured 1,121 tokens with OpenAI's o200k_base tokenizer. Paste your own text above for a real figure.

How many characters are in a token?

About four characters of English text on average, which is the figure OpenAI, Google and Anthropic all publish. Anthropic's current tokenizer, introduced with Claude Opus 4.7, averages closer to 2.5 characters per token. Code, numbers, JSON and languages other than English usually use fewer characters per token, so the same number of characters costs more.

Why do output tokens cost more than input tokens?

Input tokens are processed together in one pass, but output tokens are generated one at a time, each needing its own pass through the model, so they use far more computing time. Across the models on this page, output costs three to eight times the input price. On reasoning models, the hidden thinking tokens are billed as output too, which is why capping output length is one of the most effective cost controls.

Is the token count exact for Claude and Gemini?

No. Anthropic and Google do not publish a tokenizer that runs in a browser; they count tokens through their APIs, which would mean sending your text to them. This page estimates those counts from each provider's published characters-per-token figure and labels them as estimates. For an exact count, use the provider's token-counting endpoint or read the usage figures returned with each API response. Counts for GPT-5-family models are exact, because OpenAI publishes the o200k_base encoding they use.

What happens if my prompt is bigger than the context window?

The API rejects the request with an error rather than silently cutting it short. The context window has to hold the input and the response together, so a prompt that only just fits leaves no room for an answer. Shorten the prompt, split the work into chunks, retrieve only the relevant passages, or choose a model with a larger window.

Is the text I paste sent anywhere?

No. Counting and cost calculations run entirely in your browser, and nothing you paste is uploaded, stored or sent to any AI provider. The only download is the OpenAI tokenizer file, about 2 MB, which is fetched from this site the first time you use the tool.