Token Counter
Count exact tokens for GPT-5, GPT-4o, GPT-4, and GPT-3.5, plus estimated counts for Claude and Gemini — with a visual token breakdown and API cost estimate. Free, no sign-up.
Word Counter
Need words/characters instead of tokens?
JSON Formatter & Validator
Tokenizing API payloads? Format them first
Type some text to see the token breakdown
Model
OpenAI (Exact)
Anthropic (Estimated)
Google (Estimated)
Token Count
Pricing is an approximate snapshot and changes over time — always verify current rates on the provider's pricing page before budgeting.
Support Our Free Tools
If you find this calculator helpful, please consider supporting our work. Your contribution helps us build and maintain these free tools for everyone.
Buy me a coffeeFree Token Counter — Exact GPT Tokenization, Visual Breakdown, Cost Estimate
This Token Counter uses gpt-tokenizer, a JavaScript implementation of the exact Byte Pair Encoding (BPE) that powers OpenAI's own tiktoken library. For GPT-5, GPT-4.1, GPT-4o, GPT-4, GPT-3.5 Turbo, and the o1/o3 reasoning models, the token counts shown here are exact — not approximated — because tokenization runs entirely in your browser using the real production encoding tables.
Claude and Gemini don't have an open, client-side tokenizer published by their providers, so counts for those models are clearly labeled estimates based on character and word ratios typical for English text. Need to count words or characters instead? Try the Word Counter.
What Is a Token?
Language models don't read text character-by-character or word-by-word — they process tokens, chunks of text produced by an algorithm called Byte Pair Encoding (BPE). A token might be a whole word ("hello"), part of a word ("token" + "izer"), a single character, or even a punctuation mark. On average, one token is roughly 4 characters or 0.75 words of English text — but this varies significantly by language, formatting, and content type (code and non-English text often use more tokens per character).
Every model has a fixed context window — the maximum number of tokens it can process in a single request, including both your prompt and its response. Understanding your token count helps you stay within these limits and estimate API costs, since providers charge per token, not per character or per request.
Model Encodings Explained
| Encoding | Vocabulary Size | Used By | Notes |
|---|---|---|---|
| o200k_base | ~200,000 | GPT-5, GPT-4.1, GPT-4o, o1, o3 | Newer, generally more token-efficient |
| cl100k_base | ~100,000 | GPT-4, GPT-4 Turbo, GPT-3.5 Turbo | Standard encoding since GPT-3.5/4 |
This is why the same text can produce a different token count depending on which model you select — try switching models above and watch the count change.
Frequently Asked Questions
Are the GPT token counts exact or estimated?
Exact for OpenAI models. This tool uses gpt-tokenizer, a JavaScript port of the same Byte Pair Encoding used by OpenAI's official tiktoken library — the counts for GPT-5, GPT-4.1, GPT-4o, GPT-4, GPT-3.5, and o1/o3 are the real production token counts, not approximations.
Why are Claude and Gemini shown as estimates?
Anthropic and Google haven't published an open-source client-side tokenizer the way OpenAI has with tiktoken. This tool uses a character-and-word-based approximation for those models, clearly labeled as an estimate rather than an exact count.
Why does the same sentence use a different token count on different models?
Each model family has its own vocabulary. GPT-4o and GPT-5 use a newer 200k-token vocabulary (o200k_base) that's generally more efficient, while GPT-4 and GPT-3.5 use an older 100k-token vocabulary (cl100k_base). The same text can encode into fewer tokens under the newer encoding.
Is my text uploaded anywhere when I use this tool?
No. Tokenization runs entirely in your browser using a JavaScript library — your text never leaves your device or gets sent to any server.
How accurate is the cost estimate?
The cost calculation is exact given the token count and the pricing shown, but the pricing itself is a snapshot that can go stale as providers update their rates. Always check the official pricing page for the model you're using before budgeting for production use.
Need Words or Characters Instead?
Word Counter gives you word count, character count, reading time, and more for any text.
Word CounterWorking with API Payloads?
JSON Formatter & Validator cleans up and validates JSON before you tokenize or send it to an API.
JSON Formatter & ValidatorExplore All Tools
134 free tools — no signup required
All 134 tools are free · No signup · No ads
