Token Calculator

Count tokens in any text and compare what a request costs on ChatGPT, Claude and Gemini APIs

–
tokens
–
words
–
characters
–
tokens per word

ModelInput, $/1MOutput, $/1MPer requestPer month

Frequently Asked Questions

In English, about 1.1 to 1.3 tokens per word. Our test with the o200k tokenizer (GPT-4o, GPT-5) gave 1.13 tokens per word for a typical paragraph. OpenAI's rule of thumb is 1 token for about 4 characters, or 100 tokens for about 75 words. Code, numbers, URLs and non-English text use more.
It depends on the model. On Claude Sonnet 5.5, 1,000 input tokens cost $0.002 and 1,000 output tokens cost $0.01. On GPT-5 mini it is $0.00025 and $0.002. Output tokens are almost always 4 to 6 times more expensive than input tokens, so the length of the answer usually drives the bill.
No. Tokens are counted by the js-tiktoken library inside your browser. Nothing you paste is uploaded or stored, so it is safe to check contracts, customer data or proprietary code.
Every provider uses its own tokenizer. We count with o200k, the tokenizer behind GPT-4o and GPT-5, which is exact for those models. Claude and Gemini usually land 10-30% away from it. For an exact Claude count, call Anthropic's free count_tokens endpoint; Google offers a similar countTokens method.
When every request starts with the same text (a system prompt, a document, few-shot examples), providers cache that prefix and bill repeats at 5 to 20 times less than normal input. Enter the repeated share in the calculator to see the saving on your monthly bill.

How many tokens is my text? The short answer

English text averages about 1.1 to 1.3 tokens per word, or roughly 4 characters per token. A 400-word page is about 450 tokens, a 1,500-word blog post about 1,700, and a 20-page contract around 9,000. The token counter above gives you the exact count for GPT-4o and GPT-5 and a close estimate for Claude and Gemini, then turns it into a dollar cost per request and per month for 15 current models from OpenAI, Anthropic and Google.

What tokens are and why they matter

Large language models do not read words. They read tokens: short chunks of text that can be a whole common word ("the", "price"), part of a longer word ("un" + "believ" + "able"), a number, a space or a punctuation mark. Token count decides two things: how much an API call costs and whether your input fits in the model's context window. Every provider bills input tokens (your prompt, system instructions and conversation history) separately from output tokens (the model's reply), and quotes prices per million tokens.

This calculator runs the same tokenizer as GPT-4o and GPT-5 locally in your browser, so you can paste sensitive material without it leaving your machine. That is a real difference from many online token counters that send your text to a server.

The LLM API cost formula

Every provider uses the same basic math:

Cost per request = (input tokens × input price + output tokens × output price) / 1,000,000

Monthly cost is that number times your request volume. With caching, split input into two parts: uncached input at the full rate and cached input at the cached rate. Take Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens. A request with 800 input and 400 output tokens costs 800 × 2 / 1,000,000 + 400 × 10 / 1,000,000 = $0.0016 + $0.004 = $0.0056. At 10,000 requests a month that is $56.

Notice that the 400 output tokens cost two and a half times more than the 800 input tokens. That is the single most important thing to understand about LLM pricing.

Why output tokens dominate the bill

Output tokens cost 4 to 6 times more than input tokens on most models: Claude Sonnet 5.5 charges 5x, GPT-5.5 charges 6x ($5 in, $30 out), Gemini 3.1 Pro 6x. Generating text is far more compute-heavy than reading it. Practical consequences:

  • Cap the response. Set max_tokens and ask for concise answers or a fixed format such as JSON. Cutting replies from 400 to 250 tokens saves more than trimming your prompt by half.
  • Watch reasoning models. When a model "thinks" before answering, those hidden reasoning tokens are billed as output. A short visible answer can still cost thousands of output tokens, so test with real prompts and read the usage field in the API response.
  • Count the whole conversation. Chat APIs are stateless: each new turn resends the full history as input. The tenth message in a thread can cost several times the first, which is why summarizing or truncating history matters for chatbots.

Worked example: budgeting a support chatbot

Say your customer support bot handles 10,000 requests a month, each with 800 tokens of prompt (system instructions plus the customer's question) and 400 tokens of reply. Here is what that costs at November 2026 list prices:

ModelPer requestPer month
Claude Haiku 5.5$0.00028$2.80
GPT-6 Luna$0.00028$2.80
GPT-5 mini$0.001$10
Gemini 3.8 Flash$0.0021$21
Claude Sonnet 5.5$0.0056$56
GPT-6.1 Sol$0.0056$56
Claude Opus 5.5$0.0112$112
GPT-5.5$0.016$160

The spread between the cheapest and the most expensive option is more than 50x for the same workload. Small models handle ticket routing, short answers, classification and data extraction well. Frontier models earn their price on multi-step reasoning, coding and long documents. A sensible process: start with a small model, grade it on a few dozen real conversations, and move up only where quality falls short. Many teams route easy requests to a cheap model and escalate hard ones, which keeps the average cost close to the bottom of this table.

Now add caching. If 600 of the 800 prompt tokens are a fixed system prompt, on Sonnet 5.5 those 600 tokens are billed at the cached rate of $0.10 per million instead of $2. Input cost per request drops from $0.0016 to $0.00046, and the monthly bill falls from $56 to about $44.60. Because the reply is still 400 full-price output tokens, caching alone cannot cut this bill by more than about 30%. Shortening the reply would.

Prompt caching and the Batch API

Prompt caching pays off whenever requests share a long, identical prefix: a system prompt, a product catalog, a policy document, few-shot examples. Cached reads cost 5-10% of the normal input price on most current models. Put the stable content first and the variable part (the user's question) last, because the cache only matches from the beginning of the prompt. Some providers charge a small premium to write the cache the first time, so it helps most when the same prefix is reused many times within a short window.

The Batch API from OpenAI, Anthropic and Google gives roughly a 50% discount in exchange for asynchronous results, typically within 24 hours. It is a good fit for nightly reports, bulk translation, document tagging and evaluation runs, and a poor fit for anything a user is waiting on. The same 10,000 Sonnet requests from the example above would cost about $28 through batch.

Long-context surcharges and context windows

Some models switch to a higher price tier once a single request gets very long. On OpenAI GPT models the surcharge applies above 272K input tokens, on Gemini 3.1 Pro above 200K, and on Claude Haiku 5.5 above 100K. The calculator shows standard prices for normal-length requests, so if you plan to feed whole codebases or book-length documents, check the long-context row on the provider's pricing page. Long prompts also hit the context window limit, which caps input and output combined, so leave room for the reply.

Tokens per word by language

Tokenizers are trained mostly on English, so other languages split into more pieces. We ran the same 80-word English paragraph and its translations through the o200k tokenizer:

LanguageTokensTokens per wordvs English
English901.131.00x
Spanish1011.201.12x
German1051.421.17x
Polish1302.031.44x
Ukrainian1412.071.57x

If your app serves Spanish-speaking users, expect around 12% more tokens than English for the same content; for German about 17%, for Polish about 44%. A common trick is to keep a long system prompt in English even when the bot answers in another language.

Typical English texts in tokens

TextApprox. wordsApprox. tokens
Chat message2023
Email150170
Single-spaced page400450
Blog post1,5001,700
20-page contract8,0009,000

Code, JSON, tables and long numbers tokenize less efficiently than prose and usually need noticeably more tokens for the same length, so paste a real sample instead of relying on word counts when your input is structured data.

Where the prices come from and how accurate the count is

Prices come from the official OpenAI, Anthropic and Google pricing pages at standard (non-batch, non-enterprise) rates. A few are temporary: Gemini 4 Argon doubles in price on December 1, 2026, and Gemini 3.8 Flash doubles on January 1, 2027. The calculator knows these dates and switches to the new prices on its own.

Token counts are exact for GPT-4o and GPT-5 because we use their o200k tokenizer. For Claude, Gemini and newer OpenAI models the number is an estimate, typically within 10-30%. Before committing a large budget, confirm with the provider's own tool: Anthropic's free count_tokens endpoint, Google's countTokens, or the usage numbers returned with every API response.

To compare two quotes, the percentage calculator shows how much more one model costs than another, and the percent change calculator helps you track how your bill moves month to month. If you are pricing an AI feature into a larger project, the website cost calculator covers the rest of the build.