AI Token Counter
Count tokens for GPT-4o, GPT-4, Claude and Gemini as you type. Exact for OpenAI's tokenizers, estimated for Claude and Gemini — and completely private, because it all runs in your browser.
Estimated — Anthropic and Google don't publish an offline tokenizer. Close, but not billing-exact.
Token breakdown
Each chip is one token. Spaces show as · and line breaks as
↵.
Why count tokens?
Every large language model bills, rate-limits and context-windows by tokens, not words or characters. If you're writing prompts, building with an API, or trimming a document to fit a context window, the token count is the number that actually matters. This tool gives you that number instantly — exactly for OpenAI's models, and as a close estimate for Claude and Gemini.
How to use it
- Pick your model from the dropdown. OpenAI models are marked exact; Claude and Gemini are marked estimate.
- Type or paste your text. The token count updates with every keystroke.
- Check the breakdown. For OpenAI models you'll also see each individual token highlighted, so you can see exactly where the text splits.
Exact vs. estimated
- OpenAI (exact): the real tokenizers —
o200k_basefor GPT-4o, GPT-4.1 and the o-series,cl100k_basefor GPT-4 and GPT-3.5 — are bundled and run locally. The counts match the API. - Claude & Gemini (estimate): neither Anthropic nor Google ships an offline tokenizer, so an exact count requires an API call with a key. To stay private, this tool estimates from the o200k tokenizer with a per-model scaling factor. Expect it to be close, but verify against the provider for billing-critical work.
Tokens, characters and words
As a rule of thumb, one token is about four characters or roughly three-quarters of a word in English — so 100 tokens is around 75 words. Code, punctuation-heavy text, and non-English languages tokenize less efficiently, which is why this tool shows the live characters-per-token ratio for your actual text rather than a fixed guess.
Frequently asked questions
What is a token?
Large language models don't read characters or words — they read tokens, which are common chunks of text (a short word, part of a word, or a piece of punctuation). Roughly one token is about 4 characters of English, but it varies by model and language. Pricing and context limits are all measured in tokens, which is why counting them matters.
Which models give an exact count?
OpenAI models are exact. GPT-4o, GPT-4.1 and the o-series use the o200k_base tokenizer; GPT-4, GPT-4 Turbo and GPT-3.5 use cl100k_base. Both are the real tokenizers OpenAI publishes, bundled here and run entirely in your browser, so the numbers match the API.
Why are Claude and Gemini shown as an estimate?
Anthropic and Google do not publish an offline tokenizer — the only way to get an exact count is to call their API with a key. To keep this tool fully private and client-side, Claude and Gemini counts are estimated from the o200k tokenizer scaled by a per-model factor (Claude tends to run ~15–20% denser than tiktoken, Gemini is close to o200k). Treat them as a close guide, not a billing-exact figure.
Is my text private?
Yes. Every count happens locally in JavaScript. Nothing is uploaded, logged or stored — including for the estimated models, which never contact any API.
What is the token visualization?
For the exact OpenAI models, each token is shown as a separate highlighted chip so you can see exactly how your text is split. Spaces are shown as · and line breaks as ↵ so token boundaries are easy to read.