Token Counter: GPT, Claude, and Gemini Token Estimator
Count tokens live for GPT, Claude, Gemini, and Llama models. See word and character counts, tokens per word, and an editable per-million-token cost estimate.
Cost estimator (editable, verify current pricing)
| Price point | $ / 1M tokens | Estimated input cost |
|---|---|---|
| GPT-4o input (2026) | $0.0000 | |
| GPT-4o mini input (2026) | $0.0000 | |
| Claude Sonnet input (2026) | $0.0000 | |
| Gemini Flash input (2026) | $0.0000 |
Claude, Gemini, and Llama each use a different tokenizer than OpenAI models, so non-OpenAI counts here are close approximations, not exact counts. Tokenization runs entirely in your browser; nothing you type is uploaded anywhere.
What this tool does
Paste any text and this tool tokenizes it live using the real byte pair encoding OpenAI models use, so the GPT-4o, GPT-4, and GPT-3.5 counts are exact, not approximated. It also reports word count, character count, and a tokens-per-word ratio, which is a quick way to gauge how token-dense a piece of writing is: technical text and code typically run higher tokens per word than plain prose. Below the counts, an editable cost table lets you estimate input cost against a handful of preloaded 2026 price points per million tokens, useful for budgeting a prompt, a batch job, or a fine-tuning dataset before you run it.
Who it's for
Developers and prompt engineers estimating context window usage or API cost before sending a request, writers checking whether a document fits inside a model's context limit, and anyone comparing how differently the same piece of text tokenizes across model families.
How to use it
- Paste or type your text into the box.
- Pick a model from the dropdown to switch the tokenizer used for the count.
- Read the live token count, word count, character count, and tokens-per-word ratio.
- Open the cost estimator table and edit the price-per-million-tokens figures to match current published pricing if needed.
- Compare the estimated input cost for your pasted text across each price point in the table.
Good to know
GPT-4o, GPT-4, and GPT-3.5 counts use the actual OpenAI tokenizer libraries and are exact for those model families. Claude, Gemini, and Llama each use their own different tokenizer, so counts shown for those models are close approximations based on OpenAI's tokenizer rather than the true underlying tokenizer, and can differ by a meaningful margin, especially on non-English text or code. The preloaded cost table is a snapshot of published 2026 pricing and is provided as editable so you can verify and update it against current provider pricing before relying on it for budgeting.
Frequently asked questions
Why is my token count different between GPT-4o and GPT-4?
GPT-4o and newer models use a different, more efficient encoding called o200k_base, while GPT-4 and GPT-3.5 use the older cl100k_base encoding, and the two produce different token counts for the same text. This tool switches between the exact tokenizer for each model family based on your selection, so the counts you see reflect that real difference rather than a single generic estimate.
Are the Claude and Gemini token counts exact?
No, they are approximations. Anthropic and Google use their own proprietary tokenizers that are not fully public in the same way OpenAI's are, so this tool estimates those counts using the closest available OpenAI-compatible encoding. For most English prose the approximation is close, but treat it as directional rather than exact, especially for code or non-English text.
Why does tokens per word matter?
Plain English prose typically runs around 1.3 tokens per word, but code, URLs, non-English text, and text with unusual punctuation or formatting can run noticeably higher, meaning the same word count costs more tokens and more money to process. Watching this ratio helps you spot when a document is going to be more expensive per word than it looks.
How do I use the cost estimator table to budget an API call?
Paste the text you plan to send, check the token count, then look at the estimated cost row for the model's published price per million input tokens, editing that price field first if the preloaded figure is out of date. Multiply by however many times you expect to send similar-sized requests to get a rough total for a batch or a day of usage.
Does this tool count output tokens too?
No, it only tokenizes and counts the text you paste in, which represents input tokens. Output token cost depends on how long a model's response is, which this tool cannot predict, so budget separately for expected response length using each provider's published output pricing.
Is any of my pasted text sent to a server?
No, tokenization runs entirely in your browser using a local JavaScript tokenizer library, so your text never leaves your device or gets uploaded anywhere. This also means the tool works offline once the page has loaded.