Skip to content
TabBench

LLM Token Counter

Estimate LLM tokens, context-window use and prompt API costs at listed model prices.

Runs in your browser. Nothing you add is uploaded.

What the LLM Token Counter does

Paste a prompt, document or code and get an estimate of its token count, words and characters, how much of a model's context window it would fill, and what it would cost as input or output at the listed price. The count is an estimate, calibrated against OpenAI's o200k tokenizer and scaled for Claude and Gemini using the ratios those providers publish, not each provider's real tokenizer. It is good for budgeting and for checking whether something will fit. Prices are standard list prices for current OpenAI, Anthropic and Google models, with the date they were last checked shown under the table.

How to estimate tokens and API cost

  1. Choose a model from the list: GPT-6 Astra, Sol and Luna, Claude Fable, Opus, Sonnet and Haiku, or Gemini Pro and Flash.
  2. Paste your text, or load a sample: a system prompt, TypeScript code or a JSON payload.
  3. Read the estimated tokens, tokens per word, words and characters, and the input cost at the listed price. A long prompt switches to the higher long-prompt rate where a model has one.
  4. Check the context-window bar to see how much of the model's limit the text uses.
  5. Compare the estimated prompt and completion cost across every listed model in the table.

The LLM Token Counter runs entirely in your browser — nothing you enter is uploaded, stored, or logged.

When to use it

Will it fit?

A long contract, a large source file or a chat history can exceed a model's context window, and anything over the limit is cut off or rejected. The capacity bar shows the share used. Leave headroom, because the window also has to hold the system prompt, any tool definitions and the model's reply.

Trimming a prompt that runs on every request

A system prompt is sent with every call, so its tokens are paid for thousands of times. Cutting a 2,000-token prompt to 1,200 saves 800 tokens per request, which at 100,000 requests a month is 80 million input tokens. The Prompt & Context Cleaner can strip markup and comments before you count.

Rough budgeting

Multiply the estimated input tokens by your expected number of requests, add an allowance for output tokens, which usually cost several times more per token, and you have an order-of-magnitude monthly figure before writing any code.

Good to know

  • For ordinary English prose, a token averages about four characters, or roughly three-quarters of a word. Code, JSON, numbers and non-English text use more tokens per word.
  • The same text costs more tokens on some models than others. Anthropic says the tokenizer in Claude 4.7 and later models produces about 30% more tokens than its previous one, so the estimate for Claude models is scaled up by that much; Gemini is scaled by Google's figure of about four characters a token.
  • Output tokens cost more than input tokens on most models, so a long answer can cost more than the prompt that asked for it.
  • The text is processed in your browser; nothing you paste is sent to any AI provider.
  • Some models charge more for long prompts: OpenAI's GPT-6 models above 272K tokens, Gemini 3.1 Pro above 200K and Claude Haiku 5.5 above 100K. The higher rate then applies to the whole request, input and output.
  • Prices and model line-ups change often. Treat costs here as a guide and check the provider's current pricing page before committing to a budget.

Frequently asked questions

What is an LLM token?

Tokens are the basic units of text processed by language models. In English text, 1 token is roughly equivalent to 4 characters or about 0.75 words. Complex code or non-English scripts often require more tokens per word.

Are my prompt texts uploaded anywhere?

No. All token estimation and cost calculation happens locally in your browser's JavaScript engine. Your private system prompts and proprietary documents are never transmitted to any server.

How accurate is the estimate?

The estimator was checked against OpenAI's o200k tokenizer: it lands within about 5% on English prose, source code and JSON, and within 10–15% on CSS, CSV data and long URLs. Claude and Gemini figures add the providers' published ratios on top, so treat them as a little less precise. For exact counts use the provider's own tools: OpenAI publishes the tiktoken library, and Anthropic and Google offer token-counting API endpoints.

Why do different models produce different token counts?

Each provider trains its own tokenizer vocabulary, so the same word may be one token for one model and two or three for another. Counts for the same text can differ by a noticeable margin between providers.

Why are completion tokens more expensive than prompt tokens?

A prompt is processed in one parallel pass, while output is generated one token at a time, each step needing another pass through the model. That sequential work costs more compute per token, and pricing reflects it.

Page last updated . Found a wrong result or a mistake on this page? Let us know.

  • Image to Text (OCR)

    Copy text out of screenshots, scans and photos (OCR).

    Optional cloud mode

  • AI Code & Formula Explainer

    Plain-English explanations of formulas, calculations and code.

    Optional cloud mode

  • AI Text Summarizer

    Condense long text into a short summary or key bullet points.

    Optional cloud mode

  • AI Text Rewriter

    Rewrite text in a professional, friendly, concise or formal tone.

    Optional cloud mode