AI Token Counter & Cost Calculator
Paste a prompt, a document, or a whole conversation: this token counter runs the same BPE tokenizers OpenAI's models use and gives you the exact number GPT-5, GPT-4o, or GPT-4 will see. Then it prices that text across every current model from OpenAI, Anthropic, Google, xAI, and DeepSeek — per request and per month, cheapest first.
Your browser won't let a page read the clipboard — paste with ⌘V / Ctrl+V instead.
Runs 100% in your browser — your text is never uploaded. The tokenizer data (~1 MB) downloads once on first count.
What that text costs, on every model
Assuming output tokens per request requests per month
Token counts are exact for every OpenAI model here — all of them bill with o200k_base. Anthropic, Google, xAI, and DeepSeek don't publish browser tokenizers, so their rows show the same o200k count marked ~, typically within 10–25% of the real figure.
Why Count Tokens Before You Send Them
API billing is per token
OpenAI, Anthropic, and Google all price per million tokens. Knowing your prompt's size is knowing its price — and the table above turns that size into a per-request and per-month figure on every model at once.
Context windows are finite
Every model has a token ceiling per request. Counting first tells you whether that long document actually fits — before the model silently truncates it.
Five providers, one table
OpenAI, Anthropic, Google, xAI, and DeepSeek side by side, sorted cheapest first — no hopping between five pricing pages to compare a model choice.
See how text tokenizes
Toggle "Show tokens" to see the exact chunks the model reads. English words are often one token; code, Cyrillic, and emoji split into more.
What Is a Token, Exactly?
Language models don't read letters or words — they read tokens: common character sequences from a fixed vocabulary. "Hello" is one token; "unbelievable" splits into several; a Cyrillic word can cost a token per syllable. As a rule of thumb, one token is about 4 characters of English text, or roughly ¾ of a word — but the only reliable way to know is to run the real tokenizer, which is what this page does.
OpenAI's current models (the GPT-5 family and GPT-4o) share the o200k_base encoding with a 200k-token vocabulary; the older GPT-4 and GPT-3.5-turbo use cl100k_base. Each row in the table above picks the right one automatically. At that ¾-of-a-word ratio, here is what round token counts look like as text — and as money, priced at a flat $1 per million so you can multiply by any rate in the table above:
| Tokens | Words | Characters | Pages | At $1 / 1M |
|---|---|---|---|---|
| 100 | 75 | 400 | 0.3 | $0.0001 |
| 500 | 375 | 2,000 | 1.5 | $0.0005 |
| 1,000 | 750 | 4,000 | 3 | $0.001 |
| 4,000 | 3,000 | 16,000 | 12 | $0.004 |
| 16,000 | 12,000 | 64,000 | 48 | $0.016 |
| 128,000 | 96,000 | 512,000 | 384 | $0.128 |
| 1,000,000 | 750,000 | 4,000,000 | 3,000 | $1.00 |
Two things bend that ratio, both upwards. Code, JSON, and non-Latin scripts split into more tokens per character than English prose: click the Code and Cyrillic samples above and the counter drops from about 5.1 characters per token to 3.5 for code and 3.8 for Russian. Every model in the table shares the o200k tokenizer, so that penalty is the same across all of them — a 4,000-character JSON payload lands past 1,100 tokens where the same length of prose costs about 800. And a chat request carries the whole conversation, not just your latest message: twenty turns in, all twenty turns are re-sent as input tokens every time you press send.
How API Pricing Works
Every major AI provider bills the same way: a rate per million input tokens plus a separate rate per million output tokens. Output is almost always the expensive side — often four to six times the input rate — so a chatty model with long answers costs more than its headline input price suggests. What lands in each bucket is where the surprises live:
| Billed as | What goes into it |
|---|---|
| Input tokens | Your prompt, the system message, few-shot examples, attached documents, tool definitions, and every earlier turn of the conversation — re-sent in full on each request. |
| Output tokens | The model's reply, plus the reasoning tokens a thinking model emits before it answers. You are billed for those even though they never reach your screen. |
| Cached input | Input tokens the provider has seen recently — a repeated system prompt, shared examples, a document you keep re-sending — billed at a discount. The table above uses standard input rates, so it is the upper bound for repetitive workloads. |
Five Ways to Cut the Bill
The cheapest token is the one you never send. These five levers are ordered by how much they typically save on a chat-shaped workload, biggest first:
| Lever | Why it works |
|---|---|
| Cap output length | Output runs four to six times the input rate, so a max_tokens ceiling — or just asking for a short answer — moves the bill more than anything else on this list. |
| Route easy tasks to the small model | Classification, extraction, and routing rarely need the flagship. In most families the mini model is 10–20× cheaper for work it handles just as well. |
| Trim the system prompt | It rides along on every request. A 300-token instruction block across 10,000 requests a month is 3M input tokens you pay for whether or not the model needed them. |
| Put the static part first | Caching discounts apply to a shared prefix. Ordering the prompt so the unchanging half comes first is what makes those discounts reachable. |
| Batch anything that can wait | Every major provider discounts asynchronous batch endpoints. If a job doesn't need an answer this second, it shouldn't pay real-time rates. |
Frequently Asked Questions
Is this token counter accurate?
Yes — it runs the same BPE tokenizer families OpenAI uses (o200k_base for the GPT-5 and GPT-4o generation, cl100k_base for GPT-4 and GPT-3.5), not a character-based estimate. The count you see is the count the API bills.
Is my text uploaded anywhere?
No. The tokenizer runs entirely in your browser — the text never leaves your device. That's also why the first count takes a moment: the tokenizer data downloads once, then everything is instant. The price table is arithmetic on that count against a static price list, so it needs no upload either.
Which tokenizer does each model use?
The GPT-5 family, GPT-4o and o3 all use o200k_base — it shipped with GPT-4o — so every model priced on this page counts the same way. Only the older GPT-4 and GPT-3.5-turbo use cl100k_base. There is nothing to choose: each row counts your text with the tokenizer that model actually bills with, and marks the non-OpenAI rows as estimates.
Does this work for Claude or Gemini tokens?
Not exactly. Anthropic and Google use their own tokenizers and don't publish browser versions, so an OpenAI-token count is only an approximation for them — usually within about 10-25%. Their rows in the price table inherit that margin, so treat those figures as a ballpark rather than an invoice.
How accurate are the prices?
They are the list prices published on each provider's official pricing page, checked on the date shown under the table. Volume discounts, enterprise agreements, free tiers, and promotional credits are not included — if you have negotiated pricing, your real bill will be lower.
Why do output tokens cost more than input tokens?
Generating text is more expensive than reading it. A model processes your whole prompt in one parallel pass, but produces its reply one token at a time — each generated token needs its own full pass through the model. Providers price that asymmetry in, so output rates are usually several times the input rate.
What is cached input?
Most providers discount input tokens they have seen recently. If your requests share a long prefix — a system prompt, few-shot examples, a document — the provider can serve that prefix from cache and bill it at a reduced rate. This table shows standard input rates, so treat it as the upper bound for repetitive workloads.
