AI Token Counter
Exact token counts for GPT-4o, GPT-4.1, GPT-5 and o-series models, labelled estimates for Claude, Gemini, Llama and Mistral, context-window usage, and a colour-coded view of every token. Your text never leaves your browser.
o200k_base · GPT-4o, GPT-4.1, GPT-5, o-series
Context window usage (as of October 2026)
| Model | Tokens | Context window | Usage |
|---|---|---|---|
OpenAI count |
0 | Enter a limit |
Estimates use characters per token (see below) because those models use different tokenizers. Context windows include the model’s reply for most models; leave room for the output. Limits vary by plan and provider and change over time.
Token visualizer
Related Tools
How to Use
- Paste your prompt or open a file — Type or paste text, or open a text file such as .txt, .md, .json, .csv or source code. The first time, the tokenizer (about 2.4 MB) loads once from this site; after that, counting is instant.
- Read the exact OpenAI count — The large number is the exact token count for the o200k_base encoding used by GPT-4o, GPT-4.1, GPT-5 and the o-series models, with characters, words and characters per token beside it.
- Check context windows — The table shows how much of each popular model’s context window your text would use. Rows marked “estimate” use a character-based range because those models use different tokenizers. Add your own limit in the custom row.
- Inspect the tokens — The visualizer colours each token so you can see how words, spaces, numbers and emoji are split. Turn on token IDs or visible whitespace, and copy all token IDs as a JSON array.
About the AI Token Counter
Large language models read text as tokens, and everything about using them is measured in tokens: context limits, rate limits and prices. WritePadPro’s AI Token Counter gives you the exact count for OpenAI’s current models, a clearly labelled estimate for other popular model families, and a visualizer that shows exactly how your text is split. It all runs in your browser, so prompts, documents and source code stay on your device.
How the exact count works
OpenAI’s GPT-4o, GPT-4.1, GPT-5 and o-series models use a byte-pair encoding called o200k_base, with a vocabulary of about 200,000 tokens. The text is first split into pieces by a pattern that separates words, numbers, punctuation and whitespace; each piece is converted to UTF-8 bytes, and the most frequent adjacent byte pairs are merged step by step, following a fixed ranking, until no ranked merge is left. Each remaining chunk is one token. The tool uses the open-source gpt-tokenizer library (version 4.0.0, MIT licence), a JavaScript port of the same encoding that OpenAI’s tiktoken uses, so its counts match. Strings that look like special tokens, such as <|endoftext|>, are counted as ordinary text.
A few reference counts with o200k_base: “hello world” is 2 tokens, “Hello, world!” is 4, “The quick brown fox jumps over the lazy dog.” is 10, and the Chinese greeting “你好,世界” is 3. A thumbs-up emoji with a skin tone (👍🏽) takes 3 tokens, because an emoji is several bytes and rarer combinations are not in the vocabulary as single tokens.
Estimates for other models
Claude, Gemini, Llama and Mistral models each use their own tokenizer, so the same text gives different counts. Exact numbers would mean sending your text to those providers’ token-counting APIs, so the tool shows a range instead, based on characters per token, and labels it as an estimate:
| Model family | Estimate used | Notes |
|---|---|---|
| Claude | characters ÷ 4 to characters ÷ 3 | Claude usually needs more tokens than OpenAI’s o200k_base for the same text, and newer Claude models use a tokenizer that can produce up to about a third more tokens than older ones. |
| Gemini | characters ÷ 4.5 to characters ÷ 3.5 | Google’s guideline is about 4 characters per token. |
| Llama 3 and later | characters ÷ 4.5 to characters ÷ 3.5 | Llama 3’s tokenizer is built on OpenAI’s tiktoken with a vocabulary of about 128,000 tokens. |
| Mistral | characters ÷ 4 to characters ÷ 3.2 | Mistral’s recent models use the Tekken tokenizer. |
Characters from Chinese, Japanese and Korean scripts are counted separately, at 0.8 to 1.5 tokens each, because the four-characters rule does not apply to them. These ranges suit ordinary prose; code, tables and long numbers can fall outside them.
Context windows
The table compares your text with the context windows of popular models as of October 2026. The figures are conservative: some providers offer larger windows on specific plans or in beta, and limits change. For OpenAI models the bar uses the exact count; for the others it uses the upper end of the estimate, so the bar errs on the full side. Remember that most models count the reply against the same window, and that a request’s chat formatting, system prompt and tool definitions add tokens too.
Reading the visualizer
Each coloured block is one token. Notice how a leading space usually belongs to the following word (“ world” is one token), how long or rare words split into pieces, how numbers are cut into groups of up to three digits, and how emoji and some accented characters span several tokens; such multi-token characters are shown as one block with a small count. Turn on “Show whitespace” to see spaces as · and line breaks as ↵, and “Show token IDs” to see the number of each token in the vocabulary. “Copy token IDs” copies the full list as a JSON array for debugging.
Who uses a token counter
Developers check prompt sizes before sending API requests, trim retrieval chunks to a token budget and debug unexpected truncation. Writers and researchers check whether a long document fits in a model’s context window before pasting it into a chat. Teams estimate costs by multiplying token counts by current prices, which are deliberately not shown here because they change often.
Frequently Asked Questions
How accurate is the OpenAI token count?
It is exact for the text itself with the o200k_base encoding, which GPT-4o, GPT-4o mini, GPT-4.1, GPT-5 and the o1, o3 and o4-mini models use. The tool runs the same byte-pair encoding as OpenAI’s tiktoken library (through the open-source gpt-tokenizer package), so “hello world” counts as 2 tokens and “Hello, world!” as 4. In a chat request, each message also adds a few formatting tokens, and images, files and tool definitions are counted separately by the API.
Why are Claude, Gemini, Llama and Mistral only estimates?
Each model family uses its own tokenizer, so the same text produces a different number of tokens. Anthropic does not publish the tokenizer of its current Claude models, and exact Claude and Gemini counts come from the providers’ own token-counting APIs, which require sending your text to them. Rather than upload anything, the tool shows a clearly labelled range based on characters per token. For billing or hard limits, confirm with the provider.
Is my text sent anywhere?
No. Tokenization runs in your browser. The only download is the tokenizer’s vocabulary file (about 2.4 MB), fetched once from writepadpro.com and then cached by your browser; it never contains your text. Files you open are read locally and are not uploaded.
What is a token?
A token is a chunk of text that a language model reads as one unit: often a whole common word with its leading space (“ world”), part of a longer word, a punctuation mark, or a piece of an emoji. Models have a fixed vocabulary of tokens (about 200,000 for o200k_base), and both their limits and their prices are counted in tokens, not words or characters.
How many words is 1,000 tokens?
For ordinary English prose, about 750 words: OpenAI’s rule of thumb is that one token is roughly four characters or three quarters of a word. Code, numbers, URLs, unusual names and most other languages need more tokens per word, which is why it is worth counting real text instead of relying on the rule of thumb.
Why does text in other languages use more tokens?
Tokenizer vocabularies are learned mostly from English and code, so common English words are single tokens while words in other languages are often split into several pieces. Scripts such as Chinese, Japanese, Hindi or Arabic can need noticeably more tokens for the same meaning, although o200k_base is much more efficient for many languages than the older cl100k_base encoding.
What is a context window?
It is the maximum number of tokens a model can handle in one request. For most models it covers everything: system prompt, conversation history, attached documents and the model’s reply. A prompt that uses 95% of the window leaves almost no room for the answer, so leave a margin for the output you expect.
Why are there no prices?
Because they change often and depend on the model version, the provider, batch or cached pricing and your plan, so any price shown here would soon be wrong. To estimate cost, multiply the token count by the current price per million tokens on your provider’s pricing page, and remember that output tokens are usually priced higher than input tokens.