Count LLM tokens and estimate API costs — instantly, in your browser. Paste any text to see exact token counts using real tokenizers (not estimates), plus a live cost calculation you can adjust to any provider’s pricing.
API cost estimator
Prices below are editable defaults — always check your provider’s current pricing page. Cost = (input tokens × input price) + (expected output tokens × output price).
| Setting | Value |
|---|---|
| Input price ($ per 1M tokens) | |
| Output price ($ per 1M tokens) | |
| Expected output tokens per request | |
| Requests | |
| Estimated total cost | $0.00 |
Tokenizers load once (~2 MB) and run locally — your text never leaves this page.
Why token counts matter
Every LLM API bills by tokens, not words or characters — and every model splits text differently. A 1,000-word English article is typically 1,300–1,500 tokens, but code, non-English text and unusual formatting can double that. If you’re budgeting an AI feature, estimating from word counts will reliably mislead you; counting real tokens with the real tokenizer is the only accurate way.
This tool runs the actual tokenizer files in your browser: the cl100k vocabulary used by the GPT-4 family, and Anthropic’s published Claude tokenizer (labelled approximate, since Anthropic’s newest models use an updated internal tokenizer). Your text is never sent anywhere.
How to use the cost estimator
- Paste your typical prompt (including system prompt and any few-shot examples — they count too).
- Enter your provider’s current input and output price per million tokens. The defaults are placeholders — pricing changes often, so check the provider’s pricing page.
- Set the expected output length. Output tokens usually cost 3–5× more than input tokens, so this often dominates the bill.
- Multiply by expected request volume to see monthly cost at a glance.
Rules of thumb worth remembering
One token is roughly 4 characters or ¾ of an English word. JSON and code tokenize less efficiently than prose. System prompts are re-sent (and re-billed) on every request, so trimming a bloated system prompt is often the cheapest optimisation available. And context you don’t need is money you’re burning — retrieval that sends only relevant chunks routinely cuts costs by 80% versus stuffing whole documents into the prompt.
Frequently asked questions
Is my text sent to a server?
No. The tokenizer files download once (~2 MB) and run locally in your browser.
How accurate are the counts?
GPT-4-family counts use the real cl100k tokenizer and are exact for those models. Claude counts use Anthropic’s published tokenizer and are a close approximation for current Claude models.
Why do the same words give different counts per model?
Each model family trains its own vocabulary. A word that is one token in one vocabulary may be three in another — that’s why per-model counting matters for budgeting.
Do images and tool calls count as tokens?
Yes — multimodal inputs and function/tool definitions are converted to tokens internally and billed. This counter covers text; check your provider’s docs for image token formulas.