LLM Token Counter
Compare token counts across models — GPT-4o, GPT-4, o1, legacy GPT-3. Runs entirely in your browser.
Encoding: o200k_base · Context: 128,000 tokens · Latest OpenAI models
Tokens
0
Characters
0
Words
0
Tokens/word
—
Chars/token
—
Cross-model comparison
Enter text above, then click "Compare all models" to see token counts for every tokenizer side by side.
About the Local Token Counter
Tokens are how language models measure text: every prompt, system message, and completion are broken into sub-word chunks that determine your API cost and whether you fit within a context window. GPT-4o uses the o200k_base tokenizer, GPT-4 and GPT-3.5 use cl100k_base, and older models use p50k_base and r50k_base — the same text produces different token counts on each.
This counter runs six tokenizers entirely in your browser using the same BPE algorithms OpenAI uses in tiktoken. No API calls, no data sent to any server — your prompts, code, and documents never leave your machine. Switch between models to compare counts, see tokens-per-word and characters-per-token ratios, and use the cross-model comparison to pick the most cost-efficient model for your workload.
How to use
- Select a model (GPT-4o, GPT-4, o1, or legacy GPT-3 models).
- Paste or type your text — the token count updates instantly.
- Review tokens, characters, words, tokens/word, and chars/token metrics.
- Click "Compare all models" to see token counts for every tokenizer side by side with context window usage.
Frequently Asked Questions
What is a token in an LLM? ▾
A token is a chunk of text that a language model processes as a single unit — typically a word, part of a word, or punctuation. English text averages roughly 1 token per 0.75 words (or about 4 characters). Models like GPT-4o, GPT-4, and Claude use different tokenizers that split text differently, which is why the same prompt can cost different amounts depending on the model.
How many tokens does GPT-4o use compared to GPT-4? ▾
GPT-4o uses the o200k_base tokenizer which is typically 10-20% more efficient than GPT-4’s cl100k_base for English text. For example, 1,000 words of English averages ~1,300 tokens with GPT-4o but ~1,500 tokens with GPT-4. Use the cross-model comparison above to see exact counts for your specific text.
Are these token counts exact? ▾
Yes for the tokenizers we implement (o200k_base, cl100k_base, p50k_base, r50k_base) — these use the same BPE algorithms as OpenAI’s tiktoken library. However, actual API usage may add a few tokens for system messages, message formatting overhead, and tool definitions that wrap your input. Add 3-5 tokens per message for chat formatting.
How do I calculate my OpenAI API cost from token count? ▾
Multiply your input tokens by the model’s input price and output tokens by the output price. For GPT-4o: $2.50 per 1M input tokens and $10.00 per 1M output tokens. For GPT-4o mini: $0.15 per 1M input and $0.60 per 1M output. This counter gives you the exact input token count — your actual cost also depends on the response length.
Why does the same text have different token counts per model? ▾
Each model family uses a different Byte Pair Encoding (BPE) tokenizer trained on different data. GPT-4o’s o200k_base handles non-English languages, code, and special characters more efficiently than GPT-4’s cl100k_base. Legacy models like text-davinci-003 use older tokenizers that are less efficient for modern text. Use the comparison view to find the cheapest model for your content.
What is the context window for each model? ▾
GPT-4o, GPT-4o mini, GPT-4, GPT-4-turbo, and o1-preview all support 128,000 token context windows. Legacy GPT-3 models like text-davinci-003 support 4,096 tokens. The comparison view shows what percentage of each model’s context window your text consumes.
Does this tool handle non-English text and emoji correctly? ▾
Yes. The tokenizers handle Unicode, emoji, CJK (Chinese, Japanese, Korean), and right-to-left scripts. Note that non-English text typically uses more tokens per word than English — Chinese averages ~1.5 tokens per character, and emoji can use 2-4 tokens each depending on the tokenizer.
Is my text sent to any server? ▾
No. This tool runs entirely in your browser using the gpt-tokenizer JavaScript library. There are no API calls, no analytics on your text, and no server-side processing. You can verify this by opening your browser’s network tab — zero requests are made while counting tokens.