LLM Token Counter
Prices verifiedHow many tokens is my text? English prose averages about 1.3 tokens per word, so 1,000 words comes to roughly 1,300 tokens on OpenAI's o200k_base tokenizer. Paste your text below for an exact count on OpenAI models and an estimate for Claude, Gemini, Grok, DeepSeek and the other leading models from every provider we track, with the cost of each call. Counting runs entirely in your browser.
$2 input · $10 output per 1M tokens
- Input tokens (est.)
- 0 · $0.00000
- Output cost
- $0.0050
Same text on other models
Runs in your browser. OpenAI models show exact counts from the official tiktoken tokenizer (o200k_base). Other providers are estimates from characters-per-token ratios, so treat them as a guide; for exact counts use Anthropic's count_tokens endpoint or Gemini's countTokens method. Each card compares your text with the model's context window and flags it once text plus output tokens no longer fit. Prices shown are standard rates; some models charge more for very long prompts (for example OpenAI GPT-5.5 and later above 272K input tokens, xAI above 200K, Claude Haiku 5.5 above 100K).
Count tokens for one provider
What is a token?
A token is the chunk of text a model reads as one unit. It is not a character and not a word. In English a token averages 3 to 4 characters, but the exact split depends on the tokenizer the model was trained with, and punctuation, whitespace, code symbols and non-Latin scripts all move the count. Every API meters tokens, so they set both your bill and how much of the context window you use.
A small example: run Hello, world! through OpenAI's o200k_base encoding (the tokenizer behind GPT-4o and the GPT-5 family) and you get exactly 4 tokens: Hello, ,, world (with its leading space) and !. Claude, Gemini and DeepSeek split the same 13 characters differently because each provider trains its own vocabulary. That is why two models with the same per-token price can produce different bills for the identical prompt.
The ratio also changes with the kind of text. English prose on o200k_base comes to about 1.3 tokens per word, so a total from the word counter gives a quick first estimate. Our test of how many tokens is a word has the measured ratios for fiction, technical writing, Spanish, code and JSON on OpenAI and Gemini. Code is denser, about 3.7 characters per token in our tests, because of punctuation and unusual identifiers. Chinese on o200k_base runs at roughly 0.6 tokens per character, while older tokenizers such as cl100k_base used about one token per character, so a tokenizer change alone can move a non-English bill by 40 percent or more. Measure your own workload instead of trusting an average.
How do you count tokens in a prompt?
To count tokens in a prompt, run the exact text through the tokenizer of the model you will call. Paste it into the counter above: OpenAI models get an exact count, and Claude, Gemini, Grok, DeepSeek, Mistral and Llama models get an estimate from a characters-per-token ratio. For an exact Claude or Gemini count, use the provider's counting endpoint.
Count everything the request sends, not only the question. The system prompt, retrieved documents and earlier turns of the conversation are all billed as input tokens. Nearly every LLM tokenizer is a variant of byte-pair encoding (BPE). Training starts from bytes, finds the most common adjacent pair, merges it into a new token, and repeats that tens of thousands of times. Common pieces such as the or tion end up as single tokens, and rare strings get split into smaller ones. OpenAI's recent models use o200k_base. Anthropic switched to a new tokenizer with Claude Opus 4.7, and Anthropic says it produces about 30 percent more tokens for the same text than earlier Claude models. Gemini uses a SentencePiece vocabulary. Same family of algorithm, different vocabularies, different counts.
That is why this counter has two levels of accuracy. OpenAI publishes its tokenizer, so we run o200k_base in your browser and show the same number the API bills (OpenAI hasn't published a tokenizer for GPT-6, so those counts assume it still uses o200k_base). For other providers we estimate from a characters-per-token ratio and mark the result ~ est.: a 1,000-character technical snippet comes out at about 270 tokens on OpenAI in our tests, and by our estimates about 270 on Gemini and 286 on DeepSeek. The estimates are good enough for budgets and capacity planning. For an exact Claude or Gemini number, Anthropic's count_tokens endpoint is free to call and Gemini has a countTokens method.
Common pitfalls
Most token-counting mistakes aren't math errors. They come from comparing numbers that were never measured the same way, or from carrying an assumption over from an older model.
- Treating an estimate like an exact count. OpenAI counts here match the bill. Counts for other providers are estimates, and on code or on Claude's newer tokenizer they can be off by more than 15 percent. That gap can decide whether a feature is profitable, which is why the tool labels estimates.
- Assuming output is about the size of the input. For drafting tasks, answers often run 2 to 5 times the prompt, and reasoning models also bill their hidden thinking tokens as output. Model input and output separately, and check how each provider bills reasoning tokens.
- Reusing counts after a model change. GPT-4 used
cl100k_base, GPT-4o and GPT-5 useo200k_base, and Claude Opus 4.7 and later count about 30 percent higher than Claude 4.6. A spreadsheet built on last year's model is wrong for this year's. Recount when you migrate. - Forgetting markdown. Asterisks, backticks, headings and table pipes all cost tokens. Heavily formatted documents in a retrieval pipeline can run 15 to 25 percent above the same content as plain text, and stripping the formatting before retrieval recovers most of it.
When to use this tool
We built the counter for three jobs we kept doing by hand. The first is pricing a feature. Say it calls Claude Sonnet 5.5 ($2/$10 per million tokens) 1,000 times a day: paste a typical prompt, see about 800 input tokens, allow 600 for the reply, and the call costs about $0.0076, or $7.60 a day. Now you can check that against what you plan to charge.
The second is trimming a prompt. Write three versions of the same system prompt, count each one, and keep the shortest one that still passes your tests. Token counts turn prompt editing into something you can measure. The third is checking context-window headroom for a retrieval pipeline: add up the system prompt, typical retrieved chunks and the user message, and confirm you are well under the limit, for example the 1.05M-token window on GPT-6.1 Sol. The colored token preview helps here, because it shows where text expands unexpectedly (CJK text, dense markdown, Base64 blobs) before it reaches production. When you know your token counts, the LLM cost calculator turns them into a monthly bill across every model, or you can compare LLM API prices per 1M tokens by provider. To bring that bill down, see how to reduce OpenAI API costs.
Frequently asked
How accurate is this token counter?
OpenAI counts are exact: we run the o200k_base tokenizer in your browser, the same one GPT-5 and GPT-4o bill with (OpenAI has not published a GPT-6 tokenizer, so GPT-6 counts assume o200k_base too). Counts for every other provider we track (Anthropic's Claude, Google's Gemini, xAI's Grok, DeepSeek, Mistral and Meta's Llama) are estimates from a characters-per-token ratio, marked "~ est." in the tool, so treat them as a guide rather than an exact figure. Code, non-English text and Claude's newer tokenizer can drift further, so for an exact Claude or Gemini count use Anthropic's free count_tokens endpoint or Gemini's countTokens method.
Do input and output tokens cost the same?
No. Across the 63 models we track, output costs between 2x and 8.3x the input price, and 5x at the median. Claude Sonnet 5.5, for example, charges $2 per million input tokens and $10 per million output tokens. That gap is why capping response length is usually the fastest way to cut a bill.
Why does my prompt count differently across models?
Each provider trains its own tokenizer, so the same text splits into different pieces. OpenAI's recent models use o200k_base, Gemini uses a SentencePiece vocabulary, and Anthropic switched tokenizers with Claude Opus 4.7, which Anthropic says produces about 30 percent more tokens for the same text than older Claude models. A 1,000-character technical snippet comes to about 270 tokens on OpenAI's o200k_base in our tests and about 286 on DeepSeek by our estimate, so always price against the model you will actually ship on.
Can I count tokens for any model?
Yes, any of the 63 models we track from all 7 providers. The counter opens with a few popular ones; add any other from the model list, or pick a preset to compare a whole set. Images, PDFs and tool definitions also use tokens, but each provider counts them with its own rules, so use the provider's token-counting endpoint for those. The counting itself happens in your browser, and your text is never sent to a server.
How do I reduce my token count?
Four habits do most of the work: keep the stable part of the prompt (system prompt, tool definitions, shared context) at the front so it hits the prompt cache, ask for compact JSON instead of prose, strip markdown and boilerplate from retrieved documents, and cap replies with max_tokens. Caching alone changes the picture: a 4,000-token system prompt sent a million times a month to GPT-6.1 Sol costs $8,000 uncached and about $400 when every call hits the cache.
Sources: OpenAI's tiktoken tokenizer · Anthropic's token counting docs · Google's Gemini token docs. How we check our data