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

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?
Enter your text and the tool returns an estimate of roughly one token per two characters, then multiplies that by each model's published per-million rate. Treat the number as an upper bound on cost: the estimate runs about double what a real byte-pair tokenizer returns for English prose, and it over-counts code, JSON and especially CJK text.
Which AI models are supported?
The pricing table covers GPT-4o, GPT-4o-mini, Claude 3.5 Sonnet, Claude 3.5 Haiku, Gemini 1.5 Pro, Gemini 1.5 Flash, Llama 3.1 70B, Llama 3.1 8B, DeepSeek V3 and DeepSeek R1. Rates are pinned in the page source and dated 2024-2025, so confirm current pricing with the provider before budgeting.
Is my prompt sent to an API?
No. The estimate is computed in your browser from character length alone - no tokenizer vocabulary is bundled and no request leaves the page. Your text is not logged or stored.
How accurate is the token count?
Not very, by design. It is a character-count approximation rather than a byte-pair encoding, so it is useful for comparing models or checking whether a document plausibly fits a context window, and not for billing. For an exact count run tiktoken for OpenAI models or Anthropic's count-tokens endpoint.
Is my data sent to a server?
No. Every tool on jsonversal runs entirely in your browser using the Web Crypto API, File API, and Clipboard API. Nothing is ever uploaded — not even the JSON you paste in.
Do I need an account or API key?
No signup, no email, no API key. All tools are free to use with no signup required.
Can I use these tools offline?
Yes. Once the page loads, all tools work offline. There are no external API calls or CDN dependencies at runtime.
🔒
Your data never leaves your device

All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.

esc
↑↓ navigate ↵ open esc close