Token Estimator

Estimate token count, context usage and input cost from raw text

Pricing limits: Catalog-rate estimates only — this tool does not automatically select long-prompt pricing tiers. Comparisons, rankings and savings may change at higher tiers. For tier-aware estimates of supported Anthropic Haiku 5.5 and xAI models, use the AI API Cost Calculator. Prompt thresholds count uncached plus cached input tokens per request, not monthly volume. Cache writes/storage, tool charges and batch/priority rates are excluded unless explicitly stated. Announced Google price increases are a warning, not current rates: verify the effective date on the official pricing page.
How to use this tool: Pick the content type that best matches your material, then paste a representative prompt or document. The tool estimates its tokens, cost, and fit across available models without sending your text anywhere. Tap ⓘ for more detail.
Private & Local

Text stays in your browser — it is never sent to our servers.

0 chars

Text Statistics

Enter text above to see token statistics.

Input Cost by Model

Cost = tokens × input price (output excluded)
ModelProviderInput CostContext WindowContext Usage
Source: Official provider documentation. Estimates are informational.

What this tool helps you decide

The Token Estimator helps you answer a question that sits upstream of every cost decision: how many tokens does my actual content consume? Prompts, retrieved context, and expected responses are all measured in tokens, and pricing scales with them — so a realistic token count is the foundation of a realistic budget, a check on whether content fits a model’s context window, and a way to compare the “weight” of different prompt designs.

Why token counts vary

There is no single, universal token count for a piece of text. The number depends on the tokenizer, and different model families tokenize differently. The main sources of variation:

  • Tokenizer: each model family splits text into tokens using its own vocabulary, so the same paragraph can produce different counts across providers.
  • Language: English is relatively token-efficient; many other languages — especially those not written in the Latin alphabet — use more tokens per character.
  • Punctuation & formatting: heavy punctuation, whitespace, and markdown add tokens that plain prose does not.
  • Code: symbols, indentation, and identifiers fragment into more tokens than equivalent-length English.
  • Structured data: JSON, tables, and XML carry many delimiter tokens (braces, quotes, commas) relative to their information content.

This tool applies an average heuristic per content type, which is why the “Content Type” switch matters. It gives you a strong ballpark, not the exact count a specific provider’s tokenizer would return.

How to turn an estimate into a budgeting range

Because the estimate is approximate, convert it into a range rather than a single figure:

  • Take the estimated tokens for a representative prompt and add a margin for tokenizer differences.
  • Multiply by your expected request volume to get a monthly token figure.
  • Add expected output tokens separately — output is usually priced higher than input.
  • Feed the low and high ends of that range into the API Cost Calculator to bracket your bill.

Illustrative estimation scenarios

These illustrate how the same character count can imply very different token loads. They are illustrative planning patterns, not exact provider tokenizer outputs.

Plain English prose

A support reply or article paragraph in standard English.

Illustrative planning assumptions — not provider benchmarks
  • Latin-alphabet English text
  • Light punctuation, minimal formatting
  • Roughly 4 characters per token as a rule of thumb

What this suggests: Token count tracks closely with word count. The estimate is at its most reliable here; a modest margin covers tokenizer differences.

Source code snippet

A function or config block pasted into a prompt for review or generation.

Illustrative planning assumptions — not provider benchmarks
  • Dense symbols, indentation, and identifiers
  • Fewer characters per token than prose
  • Formatting whitespace also consumes tokens

What this suggests: Expect more tokens than the same character count of prose. Use the Code content type and budget with a wider margin.

Structured JSON payload

A data object or API response included as context.

Illustrative planning assumptions — not provider benchmarks
  • Many delimiter characters (braces, quotes, commas)
  • Repeated keys across records inflate token count
  • Whitespace/pretty-printing adds further tokens

What this suggests: Delimiters dominate the count. Minifying JSON and trimming unused fields can noticeably reduce tokens before you even choose a model.

Decision factors & limitations

  • This is a heuristic estimate, not the exact output of any single provider’s tokenizer.
  • Context-window usage shown per model is based on the same estimate and inherits its margin of error.
  • Only input cost is estimated here; output tokens are billed separately and often at a higher rate.
  • Your text is processed locally in your browser and is never sent to a server or provider.
  • Official sources are checked on a recurring schedule. Unusual or structural changes are held for human review.

Sources & methodology

See how token heuristics and prices are applied and reviewed, and which providers are currently verified:

How this calculation works

Paste your text or prompt into the tool. It applies an average tokenization heuristic (typically ~4 characters or ~0.75 words per token for English text) to estimate the token payload, and instantly calculates the input cost against selected models.

Frequently Asked Questions

Is this using the exact tokenizer for each model?
No, this tool provides an approximation using a standard tokenizer heuristic. Different models (like GPT-4 vs Claude 3) use different tokenization schemes, so exact counts will vary slightly.
Does it work for code or non-English text?
Yes, but the token-to-character ratio changes significantly. Code and non-English languages typically consume more tokens per character than standard English text.