Servinza logoservinza / tools

LLM Token Counter

Estimate GPT-style and Claude-style token counts for any piece of text. Free to use, no signup required for occasional use.

What is the LLM Token Counter?

The LLM Token Counter estimates how many tokens a piece of text will consume when sent to a large language model like GPT or Claude. Language models don't process text as raw characters or whole words — they break it into 'tokens,' which are often sub-word chunks, and every API call is priced and rate-limited based on token counts rather than character or word counts. This makes it easy to underestimate how much a prompt actually costs or how close it is to a model's context window limit, especially for languages other than English, code snippets, or text with lots of punctuation and special characters, all of which tend to tokenize less efficiently than plain English prose. This tool runs a standard GPT-style byte-pair-encoding tokenizer directly to give you an accurate token count for OpenAI-style models, alongside a comparable estimate for Claude-style tokenization, so you can budget prompts, estimate API costs, or check whether a document will fit inside a model's context window before you ever make a live API call. It's useful for developers building on top of LLM APIs, prompt engineers iterating on system prompts, and anyone trying to estimate usage costs ahead of time.

How to use it

Paste or type your text into the input box — this can be a short prompt, a full system prompt, a document you're planning to send as context, or a code snippet. Click 'Count tokens' and the tool will process your text and display the estimated token count for GPT-style tokenization alongside a comparable Claude-style estimate, plus the total character and word counts for reference. If you're testing multiple versions of a prompt to reduce token usage, edit the text and click 'Count tokens' again to compare results side by side. Keep in mind that token counts can vary slightly between different model families and even between versions of the same model family, so treat the numbers here as a close, practical estimate rather than the exact figure an API provider will bill you for — always check your provider's dashboard for final usage.

Frequently asked questions

Why is the token count different from the word count?

Tokenizers split text into sub-word chunks rather than whole words, so common words might be one token while rare words, code, or non-English text can split into several tokens each.

Is the Claude-style token count exact?

It's a close approximation based on typical tokenization behavior for Claude-family models. Anthropic's exact tokenizer isn't publicly distributed, so treat this figure as a practical estimate rather than an exact bill.

Does this tool send my text to any AI API?

No. Token counting runs using a standard tokenization library and does not require calling an external AI model.

Why does the same text produce different token counts for GPT vs Claude?

Different model families are trained with different tokenizer vocabularies, so the same sentence can be split into a different number of tokens depending on which model's tokenizer is used.

Related tools