Token Counter
Exact OpenAI tiktoken counts (o200k & cl100k) plus Claude, Gemini, and DeepSeek estimates. Free, private, browser-local.
Paste text
Privacy: Text never leaves your browser. OpenAI counts use a local tiktoken port. No API key.
Token counts
| Tokenizer | Tokens | Accuracy | Notes |
|---|
How to Use
- 1Paste the prompt or document you plan to send to a model.
- 2Use o200k for modern OpenAI models; cl100k for GPT-4 / 3.5.
- 3Treat Claude / Gemini / DeepSeek rows as planning estimates.
- 4Jump to the LLM Cost Calculator to turn tokens into monthly $.
Why counts differ
Code & URLs
Often more tokens than plain prosePunctuation and paths split into many BPE pieces.
CJK / emoji
Higher tokens per visible characterCharacter heuristics undercount; tiktoken stays exact for OpenAI.
Tips
- •System + tools + history all count toward the context window, not just the user message.
- •For Claude billing-critical work, confirm with Anthropic’s count_tokens API.
- •Shorter prompts usually beat “clever” compression that models ignore.
- •Pair this with the cost calculator when comparing model tiers.
How the counter works
The page runs in two places. The browser decodes your text and the page counts characters, words, and lines. A Web Worker loads two OpenAI encodings from gpt-tokenizer: o200k_base and cl100k_base. Those counts are exact for the OpenAI tokenizers. The worker also decodes the first 48 o200k tokens for the preview strip.
The other rows use arithmetic, not a vendor tokenizer. Claude is the average of round(o200k * 1.05) and ceil(chars / 3.5). Gemini is ceil(chars / 4). DeepSeek copies the o200k count. The browser does all of this. No text, prompt, or file leaves the page, and the tool needs no API key.
On browsers without Worker support, the same code runs on the main thread and can pause on a very large document. The counter does not strip whitespace, so the character count includes spaces and line breaks.
Three real counts
We ran three texts through the same counter code the page uses on 2026-11-16. Each row is a separate input, not a combined total. The public-domain sample is the opening paragraph of The Time Machine by H. G. Wells, from Project Gutenberg. The email and code sample are our own test text.
Tested on 2026-11-16.
| Text | Chars | Words | o200k | cl100k | Claude est. | Gemini est. |
|---|---|---|---|---|---|---|
| Support email, 8 lines | 381 | 69 | 83 | 82 | 98 | 96 |
| TypeScript snippet, 23 lines | 621 | 61 | 188 | 191 | 188 | 156 |
| Public-domain paragraph, 1 line | 562 | 95 | 119 | 122 | 143 | 141 |
Two details stand out. The code snippet has more o200k tokens than the prose sample even though it has fewer words, because punctuation and identifiers split into small pieces. The same code also counts three tokens higher under cl100k than under o200k. A single count without the encoding name is not enough.
What this counter cannot tell you
- The Claude, Gemini, and DeepSeek rows are estimates. They do not use the vendors' tokenizers, and the page says so on each row.
- The count covers the text you paste. It does not add the system prompt, tool schemas, chat history, or the provider's message wrapper.
- Images, audio, and PDF pages are not counted. Use the provider's own multimodal token guide for those inputs.
- The preview shows the first 48 o200k tokens only. It is a teaching aid, not a full token map.
- A count is not a bill. The provider's model, cached input rate, and output length decide the price.
When to use something else
- For a dollar estimate, use the LLM Cost Calculator with the counts from this page.
- For Claude or Gemini billing, use the vendor's count API. Anthropic publishes
count_tokens, and Google publishescountTokens. - For tool-schema size, use the MCP Tool Checker. It estimates schema tokens from the JSON payload.
- For prompt quality rather than length, use the Prompt and Rules Linter.
Frequently Asked Questions
How accurate is this token counter?
OpenAI rows use gpt-tokenizer (a pure-JS port of tiktoken) with o200k_base and cl100k_base. Those counts match OpenAI’s tokenizer. Claude, Gemini, and DeepSeek rows are labeled estimates because those vendors don’t publish a browser tokenizer.
What is o200k_base vs cl100k_base?
o200k_base is used by GPT-4o, GPT-5.x, and o-series models. cl100k_base is used by GPT-4 and GPT-3.5. The same English text can produce slightly different counts under each encoding.
Does my text leave the browser?
No. Tokenization runs entirely client-side. Nothing is uploaded.
Can I use this for billing?
Use exact OpenAI counts for OpenAI prompts. For Anthropic/Google, verify with their official count APIs before locking budgets. Pair with our LLM Cost Calculator for dollar estimates.
Why show a token preview?
Seeing how text splits into pieces helps explain odd counts for URLs, code, CJK, or emoji, and shows how BPE tokenizers behave.
Is the token counter free?
Yes. No signup and no API key required.
Related Tools
LLM Cost Calculator
Turn token counts into multi-provider $ estimates
Prompt & Rules Linter
Score system prompts and agent rules
JSON to Schema
Infer Zod for structured LLM outputs
MCP Tool Checker
Score agent tool schemas for readiness
Cursor Rules Generator
Generate AGENTS.md and .mdc rules
Prompt Diff
Compare system prompts and agent rules side-by-side