Prompt planning · Editable context budget

LLM Token Calculator

Count your prompt, add an allowance for request overhead and reserve output space. Adjust the context budget to match your model.

Accuracy note

Raw encodings count the supplied text exactly for that encoding. Compatible model views exclude some request formatting; provider API usage remains authoritative for complete requests.

How the LLM token calculator works

Paste the text you want to measure and choose a supported tokenizer. The token total updates as you edit, while the colored pieces and numeric IDs show where the count comes from. A raw encoding measures exactly the text in the editor; a compatible model view needs the accuracy boundary shown on the relevant model guide.

Use the budget controls below the editor to add input that is outside the pasted text, reserve an output allowance and enter a context limit. The initial values are editable planning examples, not model specifications. Choose the actual limit of your deployed model and include the conversation history and request components your application will send.

LLM token calculator vs word counter

A word count describes the draft, but a context budget needs the units processed by the selected tokenizer. Source code, logs and multilingual documents can produce very different token totals for the same number of words. Counting the actual text helps you decide whether to shorten examples, remove repetition or split a document into smaller inputs.

The budget calculation is prompt tokens plus additional input tokens plus reserved output tokens. For a 1,000-token prompt, 200 additional input tokens and a 500-token output reserve, the planned total is 1,700. Against a 4,096-token limit, that leaves 2,396 tokens. This is arithmetic on your assumptions, not a forecast of generated output.

LLM token count by model

Match the counting method to the model family before comparing budgets. The directory table below shares its model and encoding data with the main model directory. Exact base text covers the supplied text under a published tokenizer; compatible views and provider-only models need extra checks before you rely on the number for a full request.

Recalculate after changing a model, template, tool definition or document. If the provider exposes a structured input-counting endpoint, use that result to validate your input allowance. The calculator does not automatically identify hidden provider formatting, select a model's maximum context, or determine future output and reasoning length.

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

What does the LLM token calculator calculate?

It counts the text with your selected encoding, then adds your additional-input and reserved-output allowances to show a planned total and remaining context.

Is 8,192 the context limit of my model?

No. It is only the calculator's editable example. Enter the limit of the exact model and serving configuration you use.

What belongs in additional input tokens?

Include input not already present in the editor, such as omitted history, tool schemas or known template overhead. Avoid adding content twice if your pasted text already includes it.

Does the output reserve predict the answer length?

No. It is space you choose to leave available. The model may use a different amount, and output limits or reasoning accounting can impose additional constraints.

Can this calculate tokens for every provider exactly?

No. Some providers require their own counting endpoint. Check the support table and model guide before treating a local total as a complete request count.

Can I use the calculator privately?

The interactive text counter and budget arithmetic run in your browser. Your pasted text is not uploaded to an application server.