
AI Token Counter - OpenAI, Claude, Gemini
Count tokens for any LLM model - paste your prompt, see exact OpenAI token counts plus estimates for Claude and Gemini. See the input cost per call at each provider's list price.
Tokens Are How LLMs See Text
Large language models don't read characters or words - they read tokens. A token is roughly a chunk of text: about 4 characters of English on average, but the exact split depends on the model's tokenizer. Common short words like "the" are usually one token. Rare words, numbers with many digits, and code can split into multiple tokens. Every API call you make to OpenAI, Anthropic, or Google charges per token in and per token out - so knowing your token counts is how you keep unit economics healthy and avoid a runaway bill.
Counting Tokens in 4 Steps
- 1
Paste Your Text
Drop in any prompt, conversation transcript, document chunk, or system message. The tool counts tokens in real time as you type - no submit button, no API call, no upload. Your text never leaves your browser.
- 2
Choose a Model
Pick the LLM you're targeting - GPT-4o, Claude, Gemini, etc. The token count updates instantly because different models tokenize differently. GPT-4o (o200k_base) compresses well-known languages tighter than older GPT-3.5 (cl100k_base), so the same text yields different counts.
- 3
Read the Cost Estimate
The cost box shows the input cost per call in US dollars, from the model's indicative list price with a link to the provider's pricing page. Multiply by your expected daily volume to forecast monthly spend before you write integration code.
- 4
Optimize and Iterate
If the count is too high, trim the prompt, summarize context, or move static instructions into a fine-tune. Re-paste, re-count, re-cost. The whole flow takes seconds and runs entirely on your machine.
Who Benefits From an AI Token Counter
If you're building or operating anything that calls an LLM API, this tool sits in your daily workflow.
Frequently Asked Questions
How accurate are the OpenAI token counts?
Accurate for the text itself - the tool uses the same o200k_base and cl100k_base tokenizers OpenAI publishes, ported to JavaScript. Real API calls add a few tokens of message formatting, so check the usage figure your API returns for the billed count.
Why are Claude and Gemini counts only "estimated"?
Anthropic and Google haven't published their tokenizers as open libraries. We approximate using a fixed characters-per-token ratio (about 3.7 for Claude, 4.0 for Gemini), so treat the result as a rough guide, especially for code or non-English text. For exact Anthropic counts, use Anthropic's count_tokens API endpoint; for Gemini, use the count_tokens method in their SDK.
Is my text sent to a server?
No. The entire tool runs in your browser. Your text never leaves your device: there is no API call and no logging of what you type. You can check this by opening your browser's Network tab while typing. The only outside links are the provider pricing pages, which open in a new tab.
Why is the same text different token counts across models?
Different models use different tokenizers (BPE vocabularies). Newer models like GPT-4o use a larger vocabulary that compresses common English words and many non-English languages more efficiently than older models. This is why migrating from GPT-3.5 to GPT-4o can give a small token reduction even before any prompt changes.
Does the cost include output tokens?
No. The headline cost covers input tokens only, at the model's indicative list price from the linked provider page. Output tokens have their own, higher price on the same page. For a full estimate, add your expected output tokens times the output price, or use the AI Cost Calculator, which prices both.
How does fine-tuning affect token counting?
Fine-tuned models use the same tokenizer as their base model, so the token counts are the same. Fine-tuning can still lower your token use, because it lets you remove repeated instructions from each prompt. Check the provider's pricing page for fine-tuned model rates, which can differ from the base model.
Why are tokens not the same as words?
Tokenizers split based on byte-pair-encoded subword units, not whitespace. The word "tokenization" might be 2-3 tokens (e.g., "token" + "ization"), and a single character emoji can be 3-4 tokens because of UTF-8 encoding. Code, JSON, and non-English languages also tokenize less efficiently than plain English prose.