Token counter

Estimate input tokens and total price for OpenAI, Gemini, and Claude models. This is a planning estimate, not a billing source of truth.

Pricing model: 2.5/1M input tokens and 15/1M output tokens.

Official docs (research sources)

Gemini docs explicitly mention approx. 1 token ≈ 4 characters and provide a `countTokens` API; Claude docs provide `messages.count_tokens` and note counts are estimates; OpenAI docs recommend model tokenizer-based counting (for example tiktoken) for exact results.

Need more than a template?

Building with LLMs?

I build AI agents and workflow automation that connect to the systems you already run.

AI systems and automation →

How to use the LLM token counter

Paste a prompt, pick a model and the tool estimates how many input tokens it will use and what the call will cost, including the output tokens you expect back. The numbers are estimates. Real tokenizers differ by model, so use this for budgeting and sizing, and the provider's own counter when you need an exact figure.

  1. Paste the text you plan to send.
  2. Choose a model and enter the number of output tokens you expect.
  3. Read the estimated input tokens, output tokens and cost. Compare models to see how much the choice changes the bill.

Worked examples

A short prompt

Text:   "Summarise the attached incident report in five bullet points."
Size:   61 characters, 9 words
Input:  about 16 tokens (at roughly 4 characters per token)
Output: 200 tokens, entered by you

The estimate takes the larger of characters divided by the model's characters-per-token figure and words times 1.33.

Mistakes to avoid

  • Treating the count as exact

    OpenAI, Google and Anthropic each tokenize differently. For exact counts use tiktoken for OpenAI models, the countTokens API for Gemini and the token counting endpoint for Claude.

  • Assuming English rates for everything

    Code, JSON and text in other languages often use more tokens per character than English prose, so the estimate may run low for them.

  • Forgetting the output

    For every model in this tool, output tokens cost several times more than input tokens. A long answer can cost far more than the prompt that asked for it.

  • Ignoring the rest of the request

    System prompts, conversation history, tool definitions and retrieved documents all count as input. Paste them in too, or the total will be short.

Questions people ask

How can I bring the cost of a prompt down?
Trim the system prompt and the conversation history you resend on every call, retrieve only the passages that matter instead of whole documents, and use a smaller model for the easy steps in a workflow. Providers also offer prompt caching, which makes a long prefix that repeats between calls much cheaper.
Where do the prices come from?
They are list prices per million tokens stored in the tool, with a link to each provider's pricing page. Providers change prices, so confirm the current rate before you budget around a number.
Does my text leave the browser?
No. The estimate is calculated locally.

Related