LLM Token Counter — GPT Tokenizer, Free & Private
- This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.
Your text
GPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini
Anthropic and Google do not publish their tokenizers, so no browser tool can give an exact count for them. As a rough guide, English text averages about four characters per token: ≈ 0 tokens for this text. It is an estimate only, and code and other languages differ a lot. For an exact Claude count, use Anthropic’s token counting API.
About this tool
Paste a prompt, a document or some code, or drop in a text file, and the tool counts its tokens with the same tokenizers OpenAI uses: o200k_base for GPT-5, GPT-4.1, GPT-4o, o1 and o3, and cl100k_base for GPT-4, GPT-4 Turbo and GPT-3.5 Turbo. The counts are exact, and the text is split into coloured pieces so you can see where each token starts and ends. Tick “Show token IDs” to see the number behind each piece, or compare both encodings side by side.
A token is the unit a language model reads, usually a whole common word, part of a longer one, a number, a punctuation mark or a space. As a rule of thumb, English averages about four characters, or three quarters of a word, per token, so 1,000 words is roughly 1,300 to 1,500 tokens. Code, numbers and non-English text usually take more. A worked example: in cl100k_base, “tiktoken is great!” is 6 tokens: “t”, “ik”, “token”, “ is”, “ great” and “!”.
Claude and Gemini do not publish their tokenizers, so no tool that runs in a browser can give an exact count for them. For those models the page shows only a rough estimate (characters ÷ 4) and labels it as one. For an exact Claude figure, use Anthropic’s own token counting API. Counts differ between models and between encodings, so use the encoding that matches the model you call.
Counting runs entirely in your browser: the text is never sent anywhere, which matters for private prompts and documents. The first count downloads the tokenizer (about 1 to 2 MB), and text over 1 million characters is cut off to keep the page responsive. The coloured view shows the first 4,000 tokens, while the count covers everything. To check how long a text is in words and characters instead, see the Word Counter.
The Reduce tokens panel looks for waste and shows how many tokens each fix would save, measured with the tokenizer you selected. Safe fixes cannot change the meaning: invisible characters, spaces at the end of lines, extra blank lines and pretty-printed JSON, which is often a large saving once it is minified. Check fixes suit prose but deserve a look in code: repeated spaces inside lines, HTML comments, divider lines and repeated lines. Review fixes change the wording, such as “in order to” → “to” or dropping “please note that”. Show changes marks what a fix removes in red and what it adds in green before you apply it, with spaces and line breaks drawn as symbols so a removed space can be seen. Each fix can be applied alone or all the safe ones at once. An applied fix stays in the list, greyed out and marked Applied, so you can still see exactly what it changed, and Revert undoes just that fix (or Revert all puts the original text back). The rules never add words, and they are not a rewrite: shortening a prompt while keeping its meaning still takes a person.
Frequently asked questions
How many tokens is 1,000 words?
About 1,300 to 1,500 tokens for ordinary English, using the rule that a token is about three quarters of a word. Code, tables and other languages use more, so paste your own text for a real count.
Can this count Claude or Gemini tokens?
Not exactly. Anthropic and Google do not publish their tokenizers, so the tool gives only a rough characters ÷ 4 estimate for them, marked as an estimate. For an exact Claude count, use Anthropic’s token counting API.
Which encoding should I pick?
Use o200k_base for GPT-5, GPT-4.1, GPT-4o, o1, o3 and o4-mini, and cl100k_base for GPT-4, GPT-4 Turbo, GPT-3.5 Turbo and the text-embedding-3 models. The newer encoding often needs fewer tokens, especially for non-English text.
Why do two tokenizers give different counts?
Each tokenizer has its own vocabulary of pieces, so the same text is cut up differently. A bigger vocabulary usually means fewer, longer tokens for the same text.
How can I reduce the tokens in my prompt?
Paste it and open the Reduce tokens panel. It lists fixes with the exact tokens each saves. The cheapest wins are removing extra whitespace and blank lines, minifying JSON you paste in, and cutting wordy phrases. Beyond that, remove repeated instructions, keep examples short, and send only the context the model needs.
Does the shorter text give the same answer from the model?
Safe fixes only remove characters that carry no meaning, so the prompt says the same thing. Check and Review fixes can change code spacing or wording, so read the result before you use it, and test the prompt on your model.
Is my text sent to a server?
No. Counting happens in your browser. The tokenizer is downloaded from this site, and your text never leaves your device.