AI Token Counter & Cost Estimator

Estimate how many tokens your prompt costs, and what it'd run across Claude, GPT, and Gemini

PDF, Word, PowerPoint, OpenDocument, Markdown, CSV, JSON or code. Drop them here.

Files are read in your browser and never uploaded.

~0
estimated tokens
0
words
0
characters
This is a character/word-based approximation, not the real tokenizer each provider uses internally — expect it to land within roughly 10–15% of the actual count for plain English text. For an exact count against Claude's own tokenizer, use the Messages API's count_tokens endpoint.
0 tokens

1.00× your input length — drag to model a shorter reply or a long generated response.

Claude Fable 5.1
Anthropic
$0.00
$10/$50 per 1M
Claude Opus 5.5
Anthropic
$0.00
$4/$20 per 1M
Claude Sonnet 5.5
Anthropic
$0.00
$2/$10 per 1M
Claude Haiku 5.5
Anthropic
$0.00
$0.1/$0.5 per 1M
GPT-6 Astra
OpenAI
$0.00
$10/$50 per 1M
GPT-6.1 Sol
OpenAI
$0.00
$2/$10 per 1M
GPT-6.1 Terra
OpenAI
$0.00
$1/$5 per 1M
GPT-6 Luna
OpenAI
$0.00
$0.1/$0.5 per 1M
Gemini 4 Argon
Google
$0.00
$2/$10 per 1M
Gemini 3.8 Flash
Google
$0.00
$0.75/$3.75 per 1M
Gemini 3.1 Pro (preview)
Google
$0.00
$2/$12 per 1M
Gemini 3.5 Flash-Lite
Google
$0.00
$0.3/$2.5 per 1M
Standard list prices from the Anthropic, OpenAI and Google pricing pages, checked 2026-10-31. For a monthly budget with caching and batch discounts, use the LLM API Cost Calculator.

Was the AI Token Counter & Cost Estimator helpful?

Get new tools in your inbox

About once a month, when new tools ship. No spam, one-click unsubscribe.

We store only your email to send these updates. Privacy

About this tool

The ToolNinja AI Token Counter estimates how many tokens a piece of text would cost against a language model, and what that translates to in dollars across several current Claude, GPT, and Gemini models side by side. It uses a character/word-based approximation rather than shipping any provider's actual BPE tokenizer client-side — real tokenizers (tiktoken, Claude's tokenizer) are trained vocabularies of tens of thousands of sub-word pieces, too large to bundle for an instant, no-dependency browser tool. The approximation mirrors how those tokenizers actually behave in shape — short common words cost about one token, longer or unusual words cost roughly a token per four characters, punctuation gets its own tokens — and lands within roughly 10–15% of the real count for ordinary English prose. For an exact count, use the provider's own token-counting endpoint (Anthropic's Messages API has a dedicated count_tokens call). Everything runs 100% in your browser. Your prompt is never sent anywhere — not even to count its own tokens.

When to use it

  • →Getting a quick ballpark on how much a prompt or document would cost before sending it to an LLM API
  • →Comparing relative cost across Claude, GPT, and Gemini models for the same piece of text
  • →Estimating total spend for a batch job by multiplying a per-call estimate by call count
  • →Checking whether a document is likely to fit inside a model's context window before chunking it

Tips

  • ◆This is an approximation, not an exact count — for billing-critical accuracy, use the provider's own tokenizer or token-counting API endpoint.
  • ◆The 'assumed output length' slider lets you model cost scenarios beyond just the input — most real usage cost comes from output tokens, which are typically priced several times higher than input.
  • ◆Code and non-English text tokenize less predictably than English prose — treat the estimate as looser for those inputs.

Frequently asked questions

Can I count the tokens in a PDF or Word document?

Yes. Use Count tokens in files, or drop the files onto the page: PDF, Word (.docx), PowerPoint (.pptx), OpenDocument, Markdown, CSV, JSON and code files are read in your browser and never uploaded. The count is for the document's text. If you send the PDF file itself to Claude or Gemini, each page is also processed as an image, which costs extra tokens.

Why does my scanned PDF show no text?

A scanned PDF is a set of page images with no text layer. Models read it with vision, billed per image, so the text count doesn't apply. Run OCR first if you need the text.

Why isn't this using the real GPT or Claude tokenizer?

Real tokenizers are trained vocabularies with tens of thousands of entries — too large to bundle into a lightweight, instant-load browser tool without adding a heavy dependency. The approximation here is tuned to track real tokenizer behavior closely for typical English text, but isn't a substitute for an exact count when precision actually matters (e.g. right before a batch job you're billed for).

Why do output tokens cost so much more than input tokens?

Generating a token requires a full forward pass through the model for every single token produced, run sequentially — it can't be parallelized the way processing a big input prompt can. That computational asymmetry is why every major provider prices output tokens at roughly 4-6x the input rate.

Are the prices shown here accurate?

They're approximate list rates captured as of October 2026 — AI API pricing changes frequently as providers release new models and adjust tiers. Treat the numbers here as useful for relative comparison between models, and always check the provider's own current pricing page before making a budgeting decision.

Guides

Related tools

ToolNinja