LLM Token Estimate & Pricing Calculator
Estimate token count and projected cost across GPT-4o, Claude, Gemini, Llama and DeepSeek. A fast sanity check before you send a prompt.
Input
How token counting works
This tool does not run a byte-pair tokenizer. It walks your text two characters at a time and counts one token per pair, so the result is approximately half the character length — an order-of-magnitude figure, not a billable one. Real tokenizers split on subword boundaries, so actual counts differ substantially and unevenly: expect roughly half this number for English prose, a wider gap for code and JSON, and a genuine mismatch for CJK text, where each ideograph is commonly its own token. For exact counts, use tiktoken for OpenAI models or Anthropic's count-tokens endpoint.
Supported models
- GPT-4o / GPT-4o-mini — OpenAI's latest flagship models
- Claude 3.5 Sonnet / Haiku — Anthropic's Claude models
- Gemini 1.5 Pro / Flash — Google's Gemini models
- Llama 3 / 3.1 — Meta's open-source models
- DeepSeek V3 / R1 — DeepSeek models
About LLM Token Calculator
Tokens are the chunks of text that language models read and generate; roughly one token equals about four characters or three-quarters of an English word. Because providers bill per token on both input and output, longer prompts and responses translate directly into higher API costs. This tool gives you a fast estimate of that cost so you can budget before you build.
The count here is deliberately approximate — it is derived from character length rather than from any model's vocabulary, and it typically lands around twice the true figure. Every provider tokenises differently, so use the number to compare models or to check whether a document plausibly fits inside a context window, and verify the exact count with the provider's own tokenizer whenever precision matters. Cost figures are an upper bound for the same reason.
What the estimate actually measures
The counter is not a byte-pair tokenizer. It walks the string two characters at a time and emits one token per pair, with a different arithmetic path for a trailing odd character, so the count is approximately half the character length. Measured against 72 characters of English prose it returns 36 tokens, where `cl100k_base` would return roughly 18 — the figure runs about double throughout.
That approximation ignores subword structure entirely, so the error is not uniform. Code and JSON, which tokenise densely with many short symbols, come out further from the truth than prose does. CJK text is served particularly badly: eighteen Chinese characters return nine tokens, while a real tokenizer would produce fifteen to twenty, since each ideograph is commonly a token of its own.
Reading the pricing table
Each row multiplies your token count by that model's input or output rate per million tokens. Because the underlying estimate is inflated, treat the figures as an upper bound on cost rather than a prediction. The Llama rows are listed at zero and render as "Free", reflecting that you pay for hosting rather than per token — the row is there for shape comparison, not budgeting.
Rates are pinned in the page source rather than fetched, and the accompanying note dates them to 2024–2025. Pricing for frontier models moves frequently, so use the table for orientation and confirm the current figure before committing to a number. Displayed cost is rounded to three decimals, which means short inputs show `$0.000` — real money, but not visibly so.
Where the breakdown shows up
Counting runs on UTF-16 code units, so characters outside the basic multilingual plane — most emoji — count as two, and CJK text is measured per unit rather than per token. Only output-side rates are applied to your input count, so a chat turn with a long system prompt and a short reply is priced as though the entire conversation were generated.
For an exact number, run the provider's own tokenizer offline: `tiktoken` for OpenAI models, the count-tokens endpoint for Anthropic. Use this page for a fast order-of-magnitude check when choosing between models or deciding whether a document fits inside a context window, then confirm before you commit.
Frequently Asked Questions
How do I estimate LLM token usage?
Which AI models are supported?
Is my prompt sent to an API?
How accurate is the token count?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.