← All Tools

Token Counter, Cost, Context & VRAM

Estimate how many tokens a prompt uses, what it costs across the major LLM APIs, which model context windows can hold it, and how much GPU VRAM a model needs to run locally — for budgeting RAG pipelines, weighing model choices, picking a GPU, and avoiding bill surprises.

100% client-side. Your prompt and any files you add are processed locally in your browser. Nothing is sent to any vendor or to us.
⚠ Estimates, not exact counts. This page uses a heuristic tokenizer (no vendor BPE vocabulary is bundled), so expect ±~5% on English prose and more on code or non-Latin text. Each model family tokenizes differently, so the per-family numbers differ by design. For exact billing, run the vendor's own tokenizer.
How to use & examples
  1. Paste your prompt or context into the box (or click Try an example).
  2. Set the output assumption — a ratio of the input, or a fixed token budget. Output is billed separately and is usually dearer than input.
  3. Set the number of calls to project a volume total.
  4. Read the token estimate per tokenizer family and the cost matrix per model.
  5. Any price looks wrong or outdated? Edit it inline — the matrix recomputes live. Add your own model with Add a model.
  6. Export the estimate (JSON / CSV / Markdown) with the as-of date and your assumptions baked in.
CaseInputWhat you get
Good (prose)~1k words of English~1.3k GPT tokens (est.); cost e.g. GPT-4o-mini < $0.001/call
Edge (code)A dense JSON / config blobHigher token count — the symbol-density penalty kicks in above 25% punctuation
Edge (CJK)Chinese / Japanese textRoughly 1–2 tokens per character; estimate adjusts upward
Edge (empty)Nothing pasted0 tokens, $0 — no fabricated numbers

How the token number is derived: characters ÷ a per-family chars-per-token ratio (GPT 4.0, Claude 3.8, Gemini 3.7, Llama 3.9), times a code/symbol-density penalty, plus an added contribution for CJK/non-Latin characters, with a per-word floor. It is a calibrated approximation, not the vendor's real BPE. Cost formula: perCall = inputTokens÷1e6 × $in/Mtok + outputTokens÷1e6 × $out/Mtok, and volume = perCall × calls. Prices are in US dollars per 1,000,000 tokens.

—

Output assumption

Most APIs price input and output separately, with output ~3–5× dearer. Set the assumed response length:

× input tokens
tokens

Volume

Token estimates by tokenizer family

Estimated token counts per tokenizer family
Tokenizer familyInput (est.)Output (est.)Total (est.)

Cost matrix

Prices in USD per 1M tokens. Each row shows the date its price was checked against the provider (the hosted open-model rows are illustrative, from ). Figures are a list-price snapshot and may be outdated — edit any cell to use your own, and always confirm with the provider. Sources are linked per row.

Estimated cost per model, with editable prices
ModelInput $/1MOutput $/1MPer callVolume totalSourceRemove

Add a model

Not listed, or want a custom tier? Add your own row. Custom prices are yours — no source is implied.

Export estimate

Exports include the as-of date, your assumptions, and the honesty caveats, matching what you see here.

How the estimates work (method & limits)
  • GPT family (cl100k / o200k base): chars ÷ 4.0, × a symbol-density penalty, plus a word-count floor. OpenAI and OpenAI-compatible models; Mistral is close.
  • Claude: chars ÷ 3.8 (slightly less efficient on English than GPT). Claude Opus 4.7 and later models use a newer tokenizer that Anthropic says produces about 30% more tokens, so their rows multiply the Claude estimate by 1.3.
  • Long prompts: some models charge a higher rate above a prompt size (OpenAI GPT-6 and GPT-5.5 above 272K tokens, Claude Haiku 5.5 above 100k, Gemini 2.5 Pro and 3.1 Pro above 200k). The matrix switches to that rate automatically.
  • Gemini: chars ÷ 3.7 (SentencePiece; often fewer tokens on multilingual text).
  • Llama 3 / DeepSeek / Qwen / Mistral: chars ÷ 3.9 (128k-vocab BPE, similar to GPT-4o).
  • CJK / non-Latin: each character adds ~1–2 tokens on top of the Latin estimate.
  • Code & high-symbol text: a 4–10% penalty applies once punctuation density passes 15% / 25%.
  • Limits: this is a calibrated heuristic, not the real BPE. It can be off by 10–30% on code and non-Latin scripts. For exact counts use tiktoken (OpenAI), the Anthropic count_tokens API, or the vendor's tokenizer.