Token Counter
Paste any text to count its tokens with a real byte-pair-encoding tokenizer — the same kind of algorithm the models themselves use — instead of a rough characters-divided-by-four guess.
1 · Token Counter
Tokens
56
Characters
267
Words
46
Chars / token
4.77
This counter runs a real BPE tokenizer (the open-source gpt-tokenizer implementation) entirely in your browser, so the count above is exact for OpenAI models that use the selected encoding. Honest caveat: Anthropic and Google use their own tokenizers, which are not public in the same way — for Claude and Gemini models, treat this count as a close estimate, not an exact billing figure. The same English text typically lands within roughly 10–30% across providers, and Anthropic itself notes its newer tokenizer can produce around 30% more tokens for the same text than its previous one.
Which encoding should I choose?
o200k_base is the encoding used by OpenAI's newer GPT model families and is the right default for current work. cl100k_base was used by the GPT-4 and GPT-3.5 generation. The same text can produce different counts under each — try switching above and watch the number move. For Claude and Gemini models neither encoding is exact, because Anthropic and Google tokenize with their own vocabularies; use the count as a planning estimate and keep a margin in your budget.
A practical check: tokenize your real system prompt plus a typical user message and a typical reply separately. The first two are your average input tokens, the third is your average output — exactly the three numbers the cost calculator asks for.