← All Tools

🤖 Token Counter & Cost Estimator

Estimate the token count of a prompt and the cost of running it through the major LLM APIs. Useful for budgeting RAG pipelines, weighing model choices, and avoiding nasty bill surprises.

100% client-side. Your prompt is processed locally. Nothing is sent to any vendor or to us — estimation only.
⚠ Approximate, not exact. The page uses heuristic tokenizers calibrated against the real ones. Expect ±5% on English prose, more on code or non-Latin text. For exact billing, run the vendor's own tokenizer.

Output assumption

Most API costs split input from output, with output ~3-5× more expensive. Set the assumed response length:

× input tokens
tokens

Volume

Token estimates by tokenizer family

Tokenizer familyInputOutput (est.)Total

Cost matrix

Pricing snapshot dated . Click a row to override the pricing for that model.

ModelInput $/1MOutput $/1MPer callVolume total
How the estimates work
  • GPT-family (cl100k / o200k base): chars/4.0 baseline, plus a word-frequency bias term. ChatGPT and most OpenAI-compatible models.
  • Claude: Claude's BPE is similar to cl100k for English; we use chars/3.8 as a conservative estimate (Claude tends to use slightly more tokens).
  • Gemini: Gemini's SentencePiece tokenizer is competitive; we use chars/3.7.
  • Llama 3 / DeepSeek / Qwen / Mistral: 128k-vocab BPE, similar density to GPT-4o. We use chars/3.9.
  • CJK / non-Latin: each character often = 1-2 tokens. We add a CJK-character-count contribution.
  • Code & high-symbol text: dense punctuation reduces token efficiency by 10-20%; the heuristic adds an adjustment when symbol density > 25%.