LLM Token and Context Estimator

Paste your prompt and set a context budget. Counts are heuristic estimates; your model’s tokenizer and message format may produce different totals.

Runs locally in your browser
This is a transparent local estimate—not an exact provider tokenizer. No prompt content is transmitted.
Prompt or message text

Plan input and output together

Context limits usually include system instructions, conversation history, tool messages, prompt text, and generated output. Keep a safety margin for provider-specific framing and tokenizer differences.

How to estimate tokens and remaining context

Paste the prompt or message you are about to send, pick how the text should be counted, and the panel reports the estimated input size, the total budget the request plans to occupy, and how much room is left in the context window.

The estimate is recalculated in the page on every keystroke. No prompt text leaves the browser, and the calculator keeps working with the connection switched off.

  1. Paste or type the prompt into the source box. The panel updates as you type; the Estimate usage button simply forces another run.
  2. Choose the profile that matches the text: Balanced text for prose, Code-heavy when the prompt is mostly code, Multilingual when it mixes scripts or is mainly CJK.
  3. Enter the context window of the model you are targeting, the tokens you want to hold back for the answer, and the per-message overhead.
  4. Read Total planned as the budget the request will occupy, and Remaining as what is left. Planned is the input estimate plus the reserve plus the overhead.
  5. Watch the bar: it turns amber above 85% of the window and red when the plan no longer fits. Clear empties the prompt and the result and leaves the budget fields untouched.

What the estimate covers, and what it does not

How the three profiles count

Balanced text treats roughly four Latin letters or digits as one token, with small weights for punctuation and spaces. Code-heavy counts letters tighter (about 3.35 per token) and gives punctuation more weight. Multilingual starts from the UTF-8 byte length (about 3.15 bytes per token) and counts CJK characters at about one token each. Emoji count as roughly two tokens in every profile.

One sample shows the difference: “Hello world” estimates 3 tokens in Balanced text and 4 in Code-heavy or Multilingual, while “你好,世界” estimates 5 tokens from just 15 bytes. That is why the profile matters more than the raw character count.

Planned against the context window

Total planned = estimated input + reserved output + message overhead. With the page defaults — a 128,000-token window, 4,096 reserved and 12 overhead — the prompt “Hello world” shows 3 input tokens and 4,111 planned, leaving 123,889 tokens; the bar sits at 3.2% of the window.

The bar turns amber once the plan exceeds 85% of the window, a hint that a long answer may not fit, and red with an Overflow label when the planned tokens exceed the window itself.

Why a real tokenizer may disagree

These numbers come from a heuristic over characters, script and bytes, not from the vocabulary the model actually uses. Tokenizers split text differently and every model version has its own vocabulary, so treat the result as a planning figure and check a real request against the provider's counter when the budget is tight.

Keep a safety margin for system instructions, conversation history and tool messages that travel with the prompt, and reserve enough output tokens for the answer you expect.

Recent tools: