Skip to content

LLM Token Calculator

Count tokens, estimate API cost, compare models, and check context-window limits for OpenAI, Claude, Gemini, Llama, Mistral, DeepSeek, Grok, and more.

Private by default · No signup · Local token counting where supported · Exact and estimated results clearly labeled

Your text is processed in your browser for supported local tokenizers. We do not store pasted prompts.

Import .txt, .md, or .json files locally. Files are read in your browser and are not uploaded to our server.

Model comparison

Compare the current prompt, expected output, and monthly call volume across every supported model.

Same-prompt model comparison table with token count accuracy, cost, and context fit.
ModelAccuracyPrompt tokensPer-call costMonthly costContext fit
OpenAI · GPT-5.5gpt-5.5Exact
OpenAI · GPT-5.4gpt-5.4Exact
OpenAI · GPT-5.4 minigpt-5.4-miniExact
OpenAI · GPT-5.4 nanogpt-5.4-nanoExact
Anthropic · Claude Fable 5claude-fable-5Estimated
Anthropic · Claude Opus 4.8claude-opus-4-8Estimated
Anthropic · Claude Sonnet 5claude-sonnet-5Estimated
Anthropic · Claude Sonnet 4.6claude-sonnet-4-6Estimated
Anthropic · Claude Opus 4.6claude-opus-4-6Estimated
Anthropic · Claude Haiku 4.5claude-haiku-4-5-20251001Estimated
Google · Gemini 3.5 Flashgemini-3.5-flashEstimated
Google · Gemini 3.1 Pro Previewgemini-3.1-pro-previewEstimated
Google · Gemini 3.1 Flash-Litegemini-3.1-flash-liteEstimated
Google · Gemini 3 Flash Previewgemini-3-flash-previewEstimated
Google · Gemini 2.5 Progemini-2.5-proEstimated
Google · Gemini 2.5 Flashgemini-2.5-flashEstimated
Google · Gemini 2.5 Flash-Litegemini-2.5-flash-liteEstimated
Mistral · Mistral Largemistral-large-latestEstimated
Mistral · Mistral Mediummistral-medium-latestEstimated
Mistral · Mistral Smallmistral-small-latestEstimated
Mistral · Ministral 14Bministral-14b-latestEstimated
DeepSeek · DeepSeek V4 Flashdeepseek-v4-flashEstimated
DeepSeek · DeepSeek V4 Prodeepseek-v4-proEstimated
xAI · Grok 4.3grok-4.3Estimated
xAI · Grok Build 0.1grok-build-0.1Estimated
Meta · Llama 4 Scoutmeta-llama/Llama-4-Scout-17B-16E-InstructEstimated
Meta · Llama 4 Maverickmeta-llama/Llama-4-Maverick-17B-128E-InstructEstimated

Estimated rows use one local OpenAI-compatible proxy token count, so real provider counts can differ. Pricing estimate based on public model pricing. Check provider pricing before production use.

More calculators

Dedicated pages for specific providers and for API cost planning.

Token planning basics

Use the calculator for real prompts, then use these notes to understand why the numbers matter.

What is a token?

A token is the unit an LLM processes when it reads your prompt or writes a response. Tokens can be complete words, word pieces, punctuation, whitespace, numbers, emoji, or fragments of code.

Why token counting matters

Token counts affect whether a prompt fits inside a model's context window and how much an API call may cost. Planning tokens before production helps prevent over-limit prompts and surprise monthly bills.

Input vs output tokens

Input tokens are the prompt, examples, documents, and instructions you send. Output tokens are the model response you expect back. Many providers price output tokens higher, so expected response length matters.

Exact vs estimated explained

OpenAI encodings supported by gpt-tokenizer are labeled Exact. Other providers are labeled Estimated and counted with a local OpenAI-compatible proxy tokenizer because those providers do not offer an official tokenizer that runs locally in the browser.

Ways to reduce this prompt cost

General ways to lower the number of tokens you send and receive.

  • Remove repeated instructions
  • Shorten examples
  • Reduce expected output length
  • Use a smaller model for simple tasks
  • Use cached input if the provider supports it
  • Use retrieval instead of sending full documents
  • Compress long context
  • Avoid unnecessary JSON fields
  • Keep system prompts concise

Frequently asked questions

Beginner-friendly answers about token counting, pricing estimates, context windows, and privacy.

What is an LLM token?

A token is a chunk of text a language model reads or writes. A token can be a whole word, part of a word, punctuation, whitespace, a number, or part of code.

Are tokens the same as words?

No. Words are a human writing unit. Tokens are a model processing unit. One short word may be one token, while a longer word, code snippet, emoji, or non-English text may split into multiple tokens.

How many words is 1,000 tokens?

For ordinary English prose, 1,000 tokens often lands around 700 to 800 words. The real number changes with language, formatting, code, JSON, punctuation, and the tokenizer used by the selected model.

Why do different models show different token counts?

Different model families use different tokenizers. The same prompt can split into different token pieces for OpenAI, Claude, Gemini, Llama, Mistral, DeepSeek, or Grok models.

Is this calculator exact?

It is Exact only for supported OpenAI encodings counted locally with gpt-tokenizer. Other providers are labeled Estimated and use an OpenAI-compatible tokenizer as a proxy, so real provider counts can vary.

Is my prompt uploaded to your server?

No. Pasted text is processed in your browser. This site has no accounts, saved prompt history, analytics scripts, ad scripts, or server-side text processing.

Can I count tokens for code or JSON?

Yes. You can paste code, JSON, Markdown, prose, or mixed documents. The calculator also shows word and character counts so you can compare text shape alongside tokens.

Can I import files?

Yes. Use Import file locally for .txt, .md, or .json files. Files are read in your browser and are not uploaded to our server.

What are input vs output tokens, and why is output usually more expensive?

Input tokens are the prompt and context you send to the model. Output tokens are the model's response. Providers often price output tokens higher because generating text costs more compute than reading input.

What is cached input pricing?

Some providers discount repeated input that can be reused from cache. When a model publishes cached-input pricing, the calculator shows it separately. If a model does not publish it, the row stays empty or unavailable.

What is a context window, and what happens if I exceed it?

A context window is the maximum number of tokens a model can consider across input and expected output. If your total exceeds that limit, you need to shorten the prompt, reduce output length, or choose a larger-context model.

Can I estimate monthly API cost?

Yes. Enter expected output tokens and calls per month. The calculator combines those values with the selected model's public pricing to estimate per-call and monthly cost.

How do I reduce LLM API cost?

Remove repeated instructions, shorten examples, reduce expected output length, use smaller models for simple tasks, use cached input when available, and avoid sending full documents when a retrieved excerpt is enough.

Which model is cheapest?

The cheapest model depends on your prompt size, expected output length, and monthly volume. Use the comparison table to price the same text across all supported models; models without first-party pricing show Pricing varies by host.