Token Counter for GPT, Claude, Gemini, Llama and Other LLMs
Paste a prompt or a document to count tokens for the model you use, see how much of the context window it takes and what it costs through the API. The text never leaves your device.
Tokenizers are downloaded from this site and run on your device. The text is not sent anywhere, not added to the link and not passed to analytics.
- Characters
- —
- Words
- —
- Lines
- —
- Bytes (UTF-8)
- —
55 tokens
Tokens in the text
Each color is one token. Hover a token to see its ID.
This text in different models
Llama, Qwen, DeepSeek and Mistral tokenizers are 4–6 MB each, so they load only on request. Until then the table shows o200k.
| Model | Tokens | Input cost | Cost of all requests | Context |
|---|
Building a product on top of LLMs?
We integrate GPT, Claude and open models into products, build AI agents and keep the token bill under control. Tell us about your project and get an estimate.
Thank you! We will reply within one business day.
TL;DR: paste your prompt above and the counter shows how many tokens it takes in the model you picked, what share of the context window that is and how much the request costs through the API. GPT models are counted exactly with the same tokenizers OpenAI uses, Llama, Qwen, DeepSeek and Mistral with their open tokenizers, and Claude and Gemini get a labeled estimate.
We use this counter ourselves when we build generative AI integrations and AI agents for clients: the token budget of a prompt decides both the price and whether the answer fits the context window. To turn one request into a monthly budget, open the LLM spend calculator.
What is a token?
Language models do not read letters or words. The tokenizer cuts text into pieces from a fixed vocabulary: a frequent English word is usually one token, a rare word splits into two or three, and spaces, punctuation and digits are tokens too. In English one token is about four characters, or three quarters of a word. Other languages need more tokens for the same meaning. Code is dense with brackets and indentation, and numbers are split into groups of digits.
That is why the same prompt costs differently in different models, and the gap is largest for non-English text. On our test paragraph of 329 characters in Russian the GPT-4o tokenizer (o200k_base) gives 87 tokens, while the older GPT-4 tokenizer (cl100k_base) gives 150.
How to count tokens
- Paste the text or upload a .txt, .md, .json or .csv file. The counter updates as you type.
- Pick the model. The big number shows its token count, and the label tells you how precise it is: exact, close or ≈ estimate.
- Check the context window. The bar shows what share of the model limit the text takes. Remember that the answer also has to fit.
- Estimate the cost. Enter the expected answer length and the number of requests to see the price of one call and of the whole batch.
- Compare models in the table below. Press “Exact counts for open models” to load the Llama, Qwen, DeepSeek and Mistral tokenizers.
How precise is the count?
| Models | Tokenizer | Precision |
|---|---|---|
| GPT-5, GPT-4o, GPT-4.1, o-series | o200k_base | Exact |
| GPT-4, GPT-3.5 Turbo | cl100k_base | Exact |
| Llama 3.x, Qwen 3, DeepSeek-V3 | Open Hugging Face tokenizers | Exact |
| Mistral, newer DeepSeek | Mistral Tekken, DeepSeek-V3 | Close: same family |
| Gemini | Not published | Estimate, within 8% |
| Claude, Grok and others | Not published | Estimate |
We checked the GPT counts against the Python tiktoken library and the open tokenizers against Hugging Face tokenizers on ten texts in English, Russian, code, JSON and Markdown: token ids matched one to one. The Gemini estimate was calibrated against the official countTokens API.
Where the prices come from
Prices per million input and output tokens and context window sizes come from the same reference as our LLM spend calculator, with the update date shown under the cost block. If a vendor does not publish the context window for a model, the bar is hidden.
Common mistakes
- Counting words instead of tokens. Limits and prices are always in tokens.
- Forgetting the system prompt and history. In a chat every request sends them again.
- Ignoring the output. Output tokens are often several times more expensive than input: 8× for GPT-5, 5× for Claude.
- Filling the whole context window. Leave room for the answer and for tool results.
FAQ
Is my text sent anywhere?
No. The tokenizers are downloaded from this site and run in your browser, so the text stays on your device. It is not added to the link and not passed to analytics. The share link contains only the model and the cost settings.
Which tokenizer does GPT-5 use?
GPT-5, GPT-4o, GPT-4.1 and the o-series use o200k_base. GPT-4 and GPT-3.5 Turbo use cl100k_base. The counter uses the same vocabularies through js-tiktoken, so the numbers match the Python tiktoken library.
Why is the Claude count marked as an estimate?
Anthropic does not publish an offline tokenizer for current Claude models. The exact number is returned by the count_tokens API. The counter gives an estimate based on o200k_base adjusted for the language of the text.
How accurate is the Gemini estimate?
We calibrated it against the Gemini countTokens API on prose, code, JSON and numbers. On 15 test texts the difference stayed within 8%. Gemini splits every digit into its own token, and the estimate takes that into account.
Why does the same text have a different number of tokens in different models?
Each model family has its own vocabulary. A larger vocabulary covers more whole words, especially in languages other than English, so the text needs fewer tokens. Code, numbers and rare words also split differently.
How do I count tokens for a chat with history?
Paste the system prompt, the previous messages and the new message together. Chat APIs also add a few service tokens per message, so keep a small reserve.