Free LLM prompt tool

Token Counter

Paste your prompt to count tokens instantly. Switch encodings and inspect every token ID, free in your browser.

Accuracy note

Raw encodings give exact counts for the selected encoding. Model-compatible views are estimates for complete requests; chat formatting, tools and media can add tokens.

How the token counter works

Paste text into the editor above. The token counter splits your prompt using the selected tokenizer, counts the resulting tokens and displays their numeric IDs. The result updates automatically, so you can shorten a prompt and immediately see how its token count changes.

The default o200k_base encoding counts raw text without adding a chat wrapper. Use the selector at the top to switch to cl100k_base or another supported encoding. Hover over a colored token to connect its text with its ID, and turn on Show whitespace to inspect spaces and line breaks.

For example, “Hello world! 你好,世界!” contains 8 tokens with o200k_base and 11 with cl100k_base. Paste the text inside the quotation marks into this token counter and switch encodings to compare the token IDs. The same text produces different token counts because each encoding splits it differently.

Token counter vs word counter

A word counter measures words; a token counter measures the units produced by a model's tokenizer. A token can represent a whole word, part of a word, punctuation or whitespace. Code, numbers, emoji and multilingual text can split differently even when their word counts look similar.

There is no fixed word-to-token ratio that works for every prompt and model. Count the actual text with the appropriate encoding when comparing prompt length or planning context usage. Leave room for conversation history, tool definitions and the model's response when checking a context limit.

Token count by model

The same prompt can have different token counts across models because vocabularies and request formats differ. This comparison uses the same model and accuracy data as the model directory. Follow a model link for its counting method and limitations.

Exact base text means the published tokenizer counts the text you enter. Compatible means the encoding is useful for inspection but is not a guarantee of complete request usage. Exact via API requires the provider's counting endpoint; those rows do not imply that its tokenizer runs in this browser.

ModelEncoding / tokenizerIs the count exact?
GPT-5.6o200k_base (compatible view)Compatible
DeepSeek V4 FlashPublished DeepSeek V4 tokenizerExact base text
Kimi K3Published Kimi K3 vocabularyExact base text
Grok 4.5Provider tokenizer via xAI TokenizeTextExact via API
Gemini 3.6 FlashProvider tokenizer via Gemini countTokensExact via API
Claude Sonnet 5Provider tokenizer via Anthropic count_tokensExact via API
DeepSeek R1Published DeepSeek R1 tokenizerExact base text
GPT-OSS 20B & 120Bo200k_base (Harmony wrapper excluded)Compatible base text

Frequently asked questions

Is this token counter free?

Yes. You can paste text, count tokens, inspect token IDs and switch supported encodings for free without creating an account.

How do I count tokens in a prompt?

Paste your prompt into the editor and read the live token count. Choose the encoding or supported model you want to inspect from the selector at the top.

Is the token count exact?

It is exact for the selected raw encoding or supported published base-text tokenizer. A complete model request may add chat templates, tool definitions, media and other provider-side tokens.

Why does my token count change when I switch models?

Models can use different vocabularies and text-splitting rules. Chat model selections can also include conversation formatting that is absent from a raw-encoding count.

Does the token counter upload my prompt?

No. Supported tokenization runs locally in your browser. Some tokenizer files are downloaded when selected, but your prompt is not sent to an application server.

Can I count tokens without JavaScript?

The guide, model comparison and FAQs remain readable without JavaScript. Live token counting needs JavaScript to run the selected tokenizer in your browser.