LLM Token Counter & API Cost Calculator

Count tokens and estimate API cost for GPT, Claude and Gemini. Paste text, compare models side by side. Runs entirely in your browser.

Runs in your browser

GPT is counted exactly (o200k_base); Claude and Gemini are estimates. Text never leaves your browser.

Characters 0
Words 0
Lines 0
Tokens per character
Characters per token
Text

Your text stays in this browser and is never put in the URL.

Tokens
0
Input cost $0.00
Output cost · 0 $0.00
Total per request
$0.00
Cost options
×
Share of the input already in the prompt cache.
Asynchronous batch requests, typically returned within 24 hours.

This counts only the text you pasted. A real API request also carries the system prompt, tool definitions, images and chat scaffolding tokens. Prices as of 2026-09-02, per 1M tokens, from each provider’s official documentation. Source

Same text, every model — token counts are computed once per encoding.

Models to compare
ProviderInputOutputvs cheapest
GPT-5.4 OpenAI0$0.00$0.00$0.00
Claude Sonnet 5 estimate Anthropic≈ 0$0.00$0.00$0.00
Gemini 2.5 Flash estimate Google≈ 0$0.00$0.00$0.00
GPT-5 mini OpenAI0$0.00$0.00$0.00

Legacy and retired models are excluded from the “cheapest” comparison.

How to use

  1. Paste your text — the token count appears immediately.
  2. Pick a model to see input and output cost.
  3. Open “Cost options” to set the output ratio, request count and cache rate.
  4. Compare total cost across models in the “Compare models” tab.

FAQ

What is a token and how is it counted?

A token is the unit a model chops text into — usually a word fragment rather than a character or a word. GPT models use the o200k_base BPE tokenizer, which this page runs in your own browser, so those counts are exact. English prose averages about four characters per token.

Why are the Claude and Gemini counts estimates?

Neither Anthropic nor Google publishes a tokenizer you can run offline. This page scales the exact o200k_base count by a family ratio and, for Claude, by the tokenizer generation factor — accurate to roughly ±20% (Claude) and ±25% (Gemini). For an exact number call Anthropic’s messages.count_tokens or Google’s countTokens endpoint.

Why does Korean use more tokens than English?

CJK characters usually cost about one token each, while English prose averages four characters per token. For the same number of characters Korean therefore costs roughly four times as much. The “Korean efficiency” tab measures this on real sentence pairs instead of quoting a rule of thumb.

Why does a long conversation get expensive so quickly?

Chat APIs are stateless: every turn re-sends the whole history, so cumulative input grows with the square of the turn count. With a 500-token system prompt, 100 tokens per user turn and 300 per reply, ten turns send 24,000 input tokens — forty times the first turn, and four times what “one turn × ten” suggests.

How much does prompt caching save?

A cache read usually costs 0.1× the input price (sometimes 0.25× or 0.5×), while a cache write costs 1.25–2×. On a long conversation that is typically a 60–80% saving. The multipliers differ by model family, so this page uses each provider’s published cache price rather than a blanket 0.1×.

When are these prices from?

They are the list prices published by OpenAI, Anthropic and Google as of 2026-09-02; the date and the source link are shown on the page at all times. The Gemini prices are marked valid until 2026-12-31, and the page warns you when a price is close to expiring.

Related tools

More AI & Data tools: AI & Data

Send feedback

Found a bug or have an idea? Tell us — it helps make the tools better.

Only needed if you would like a reply.

Page: /ai/llm-token-counter/