An exact LLM token counter for GPT, with Claude and Gemini estimates
This LLM token counter splits your text the way OpenAI’s models do and gives the exact number of tokens for the two current OpenAI encodings: o200k_base (GPT-5.x, GPT-4.1, GPT-4o and the o-series) and cl100k_base (GPT-4, GPT-3.5 Turbo and the text-embedding-3 models). It also shows characters, words, lines and UTF-8 bytes, a colour-coded token visualiser, and bars that tell you whether a prompt fits the limits you type.
Claude and Gemini do not publish a tokenizer that runs offline, so their rows are clearly labelled estimates from each vendor’s own rule of thumb. For open models you can add the real Qwen3, Mistral NeMo and DeepSeek-V3.1 tokenizers. Paste a JSON array of chat messages and the page adds the per-message formatting tokens too.
Everything runs in a Web Worker in your browser, so even a long file stays responsive and nothing you paste is sent anywhere.
How to count tokens
- Paste text into Text, prompt or chat messages, or use Open a file for .txt, .md, .json, .csv, code or the text of a PDF.
- Read the exact o200k_base and cl100k_base counts, and the Claude and Gemini estimates, in the table.
- Under Context fit, type your model’s limit and how many tokens to keep free for the answer.
- Use the Token visualiser to see where the text is split; hover a token for its id, or tick Show token ids.
- For an open model, open Add open-model tokenizers and load Qwen3, Mistral NeMo or DeepSeek-V3.1.
LLM Token Counter features
Exact OpenAI counts
gpt-tokenizer 4.0.0 (MIT) with OpenAI’s published rank tables — ids identical to OpenAI’s own tiktoken in our checks.
Honest estimates
Claude and Gemini rows say “≈” and show the formula, because their exact counts need the vendor’s API and a key.
Token visualiser
Coloured boundaries, visible spaces, tabs and line breaks, ids on hover, and an underline where one character needs several tokens.
Chat overhead
A JSON message array gets the OpenAI Cookbook’s formatting tokens per message, per name and for the reply.
Open-model tokenizers
Qwen3 and Mistral NeMo (Apache-2.0) and DeepSeek-V3.1 (MIT), downloaded from Hugging Face only when you click.
Big files, no freeze
Counting happens in a Web Worker; the visualiser shows the first 2,000 tokens of long texts.
What a token is, with real numbers
A token is a chunk of text from the model’s vocabulary — often a whole common word with its leading space, sometimes a fragment. OpenAI’s rule of thumb is that one token is about four characters or three quarters of a word of English, but the real split depends on the text. These counts come from this tool’s tokenizer and match the examples in OpenAI’s Cookbook:
| Text | o200k_base | cl100k_base |
|---|---|---|
| Tokenization splits text into pieces called tokens. | 9 | 9 |
| antidisestablishmentarianism | 6 | 6 |
| お誕生日おめでとう (Japanese) | 8 | 9 |
| नमस्ते दुनिया (Hindi) | 5 | 13 |
The larger o200k_base vocabulary helps most outside English: the Hindi greeting needs 13 tokens in the older encoding and 5 in the newer one. To turn counts into money, use the OpenAI token calculator.
Which models use which tokenizer
OpenAI’s tiktoken library (model table checked 14 October 2026) maps GPT-4o, GPT-4.1, GPT-4.5, o1, o3, o4-mini and every “gpt-5…” model name to o200k_base, and GPT-4, GPT-3.5 Turbo and the text-embedding-3 models to cl100k_base. OpenAI has not published the encoding of the GPT-6 models; for those, o200k_base is the closest figure available offline, and OpenAI’s token-counting endpoint gives the exact number.
Anthropic says a token is about 3.5 English characters on models before Claude Opus 4.7, and that Opus 4.7 and later use a tokenizer that produces about 30 % more tokens for the same text. Google says a Gemini token is about 4 characters. Those ratios are averages for English: short, technical or non-English text can be far off, so use the vendors’ token-count APIs when an exact figure matters.
Chat messages cost more than their text
Every message carries hidden formatting — the role, an optional name and markers between messages. OpenAI’s Cookbook counts 3 tokens per message, 1 more for a name and 3 to prime the reply, and its example conversation comes to 129 tokens in cl100k_base and 124 in o200k_base, the same totals OpenAI’s API reported. Paste that conversation here and you get the same numbers. OpenAI calls the formula an estimate for newer models; tools, images and files add tokens that only the API can count.
Tips for staying under a limit
- Leave room for the answer: the limit covers input and output together, and reasoning models also spend hidden reasoning tokens.
- Trim repeated instructions and filler with the prompt optimizer — it shows the exact tokens saved.
- Structure long prompts with the prompt formatter so you can see which part is longest.
- Words still matter for people: the word counter shows reading time.
LLM Token Counter FAQ
How accurate is this LLM token counter?
For OpenAI models that use o200k_base or cl100k_base the text count is exact — the token ids matched OpenAI’s tiktoken in every test. Claude and Gemini rows are estimates from the vendors’ characters-per-token guidance.
Why is there no exact Claude token count?
Anthropic has not released a tokenizer for current Claude models. Its count_tokens API is exact for your request but needs an API key, and this page never sends your text anywhere.
Is my text uploaded?
No. Tokenizing happens in a Web Worker in your browser. Only the tokenizer code is downloaded, plus the open-model tokenizer files if you choose to load them.
Do spaces and line breaks count as tokens?
Yes. Leading spaces usually merge into the next word, but runs of spaces, tabs and line breaks become tokens of their own. Turn on “Show spaces and line breaks” to see them.
Why does the same text give different counts?
Each tokenizer has its own vocabulary. o200k_base has about 200,000 entries and cl100k_base about 100,000, so the newer one usually needs fewer tokens, especially for non-English text.
How many tokens is 1,000 words?
For ordinary English, roughly 1,300 to 1,400 tokens, using OpenAI’s rule of about three quarters of a word per token. Code, numbers and other languages can need many more, so paste the text to count it exactly.