Know how many tokens your prompt really uses and what it will cost before you send it. Tokens are not words and not characters, so the rules of thumb — four characters per token, three-quarters of a word — are wrong often enough to blow a context window or a budget. This counter runs the model's actual vocabulary in your browser, so the number you see is the split the model itself performs and the number the API bills you for. Because families tokenize differently, picking a model swaps the tokenizer rather than just the price: the same paragraph can differ by twenty percent between GPT-4o and Llama. Counts for GPT-4o, GPT-4, Llama 3, Gemma, Mistral and Qwen are exact. Anthropic publishes no tokenizer, so Claude is shown as a clearly-labelled estimate rather than dressed up as precise. You also get the token-by-token breakdown, context-window use, and a cost estimate with prices you can edit as vendors change them. Your prompt is tokenized in the page — it is never uploaded, and no model is called.
| Model | Tokenizer | Accuracy |
|---|---|---|
| GPT-4o | o200k_base | Exact |
| GPT-4 / GPT-3.5 | cl100k_base | Exact |
| Llama 3.x | Llama 3 | Exact |
| Gemma / Gemini | Gemma | Exact |
| Mistral / Mixtral | Mistral v3 | Exact |
| Qwen 2.5 | Qwen 2.5 | Exact |
| Claude | GPT-4o stand-in | Estimate — no tokenizer published |
No. The tokenizer vocabulary is downloaded once and cached, then all counting happens in your browser. No model is called and your text is never transmitted — which matters, since prompts routinely carry proprietary instructions and customer data.
For GPT-4o, GPT-4, Llama 3, Gemma, Mistral and Qwen, yes — the tool runs each model's own published vocabulary, so the split matches what the API sees. Claude is an estimate: Anthropic does not publish its tokenizer, so no offline tool can count Claude tokens exactly, and the tool says so rather than implying otherwise.
Because tokenization is not proportional to length. Code, JSON, non-English text, rare words and emoji all tokenize far more densely than ordinary English prose — a JSON blob can run two or three times the tokens the rule of thumb predicts. That gap is exactly where context windows overflow unexpectedly.
Each family has its own vocabulary, trained on different data. The same paragraph commonly differs by ten to twenty percent between GPT-4o and Llama, and more for non-English text. Switching the model here switches the tokenizer, not just the price.
They are defaults and vendors change them regularly, so treat them as a starting point and edit them. Your edits are remembered on this device. Always confirm against the vendor's own pricing page before relying on an estimate.
The tokenizer vocabulary has to be fetched the first time you use a given model — a few megabytes. Your browser caches it, so subsequent counts with that model are instant and work offline.
Tokens are not words and they are not characters, so any counter that multiplies by a ratio is guessing. This one runs the model's actual byte-pair-encoding vocabulary through Transformers.js: the tokenizer definition is fetched once, cached by the browser, and every count after that is the same split the model itself would perform — which is why a count here matches what the API bills you for rather than approximating it. Different families tokenize the same text differently, sometimes by twenty percent or more, so the model selector changes the vocabulary rather than just a price. GPT-4o and GPT-4 use OpenAI's o200k and cl100k vocabularies, and Llama, Gemma, Mistral and Qwen each use their own published tokenizer; those counts are exact. Anthropic does not publish a tokenizer at all, so no offline tool can count Claude tokens exactly — Claude is labelled an estimate and uses the GPT-4o vocabulary as a documented stand-in, rather than being presented with a precision it does not have. Cost is computed per million tokens with editable input and output prices, formatted to enough decimal places that a prompt costing a fraction of a cent does not round away to zero. Context-window use is shown against the selected model's real window. Characters are counted by grapheme through Intl.Segmenter, so a multi-code-point emoji counts as one character, and words are counted with CJK handled per character, since Chinese and Japanese are not space-separated. The text is tokenized entirely in the page: prompts, which routinely contain proprietary instructions and customer data, are never sent anywhere and no model is ever called.