Private alphaGravity is in private alpha. Apply now; your first agent is free.Apply to the alpha →
Home/Tools/Token counter
Free tool

Token counter and LLM cost calculator

Paste a prompt, an email or any text. See how many tokens it is, then what it costs per call and per month on every major model, cheapest first.

The tokenizer loads when you start typing (about 1 MB, once). Your text stays in this browser.

0tokens (o200k)
0characters
0words
0tokens per word

Exact for OpenAI models that use the o200k tokenizer. Other providers use their own tokenizers, so for Claude, Gemini, Llama and others treat the count as an estimate that can differ by roughly 10 to 20%.

What it costs on each model

Input tokens come from the counter. Set how long you expect the replies to be and how often the prompt runs.

Filled in from the counter. Type a number to override it.

About 375 words. Reasoning models also bill their thinking as output.

3,000 is about 100 a day.

0tokens a month
$0loading prices
$0loading prices

Prices from our daily LLM price tracker, updated . List prices per million tokens, before caching, batch or volume discounts.

Swipe the table sideways to see every column.

Cost per call and per month on each model. Column headers are buttons that sort the table.
Loading prices

Running the same prompt every day?Gravity runs recurring tasks as agents: describe the job in plain words and it runs on schedule, nothing to build. Private alpha, first agent free.

Apply to the alpha

What a token is

A token is the unit a language model reads and writes. Before a model sees your prompt, a tokenizer cuts the text into pieces from a fixed vocabulary: common words become one token, rarer words split into parts, and punctuation, digits and spaces are folded into tokens of their own. The model never sees letters, only token numbers, and API providers bill for every one of them.

Here is how OpenAI's o200k tokenizer, the one this token counter runs, splits a few strings. A dot (·) marks a space.

That is why the rule of thumb of four characters per token only holds for plain English. Code, numbers, names and other languages use more tokens per word, so it pays to count the real text you plan to send.

How to count tokens for GPT, Claude and Gemini

Each model family has its own tokenizer, so the same text gives a slightly different count depending on where you send it.

GPT and other OpenAI models

OpenAI publishes its tokenizers. GPT-4o, GPT-4.1, the o-series reasoning models and GPT-5 use o200k_base, the tokenizer this page runs in your browser, so for those models it works as an exact OpenAI token counter for the text itself. If you use a newer model, check its documentation for the tokenizer it uses. Chat requests also add a few tokens per message for the role markers, and images and tool definitions are counted separately.

Claude

Anthropic does not publish Claude's tokenizer as a library. Its API has a token counting endpoint that returns the input count for a request, and every response reports the input and output tokens it billed. Treat the number on this page as an estimate for Claude: it can differ by roughly 10 to 20%. To use the table as a Claude API pricing calculator, pick Anthropic in the provider filter.

Gemini, Llama and others

Google's Gemini API has a countTokens method, and open models such as Llama, Qwen and Mistral ship their tokenizer with the model weights. Without those tools, the count here is a fair estimate. Filter the table by Google to use it as a Gemini API pricing calculator.

How API cost is calculated

Providers bill input and output tokens separately, each at a price per million tokens. For one call:

cost per call = input tokens ÷ 1,000,000 × input price + output tokens ÷ 1,000,000 × output price
cost per month = cost per call × calls per month

A worked example: a prompt of 1,500 input tokens that gets a 500-token reply, on a model priced at $2 per million input tokens and $10 per million output tokens. Input costs 1,500 ÷ 1,000,000 × $2 = $0.003. Output costs 500 ÷ 1,000,000 × $10 = $0.005. That is $0.008 a call, and at 3,000 calls a month, $24.

Two things push the real bill up. Output usually costs more than input: in our 9 October 2026 price list the output price was at least double the input price on 54 of 55 models. And reasoning models bill their hidden thinking as output tokens, so set the expected output higher for them. The calculator above runs this formula for every model at once, which makes it an LLM pricing comparison as well as an OpenAI pricing calculator. For a full agent budget, with retries and tool calls, see how much it costs to run an AI agent 24/7.

Ways to cut token spend

For prototypes, several providers have free API tiers; our free LLM API tiers tracker lists the current limits. For a longer playbook, read AI agent cost optimization.

Limits of this tool

Questions

What is a token?

A token is the unit a language model reads, writes and bills by. It can be a whole short word, part of a longer word, a number or a punctuation mark. For OpenAI's o200k tokenizer, “Hello, world.” is four tokens: “Hello”, “,”, “ world” and “.”. API providers charge per token, with separate prices for input and output.

How many words is 1,000 tokens?

Roughly 750 English words with OpenAI's tokenizers, or about four characters per token. The ratio moves with the text: code, numbers, names and languages other than English use more tokens per word. Paste your own text into the counter to see its tokens per word.

Does Claude count tokens differently?

Yes. Anthropic uses its own tokenizer for Claude, so the same text can come out as a different number of tokens than OpenAI's count, by roughly 10 to 20%. For an exact figure, use Anthropic's token counting endpoint or the token usage returned with each API response. Gemini, Llama and other model families also have their own tokenizers.

Why do output tokens cost more than input tokens?

The model reads all the input tokens in one parallel pass, but it writes the output one token at a time, with a full pass through the model for each. That makes output slower and more expensive to serve. In our 9 October 2026 price list, output cost at least twice the input price on 54 of 55 models, and four times on the median model.

Is my text sent anywhere?

No. The tokenizer runs inside your browser, so your text never leaves this page. The page downloads the tokenizer and the daily price list, and analytics record only that the tool was used, never what you typed.

How current are the prices?

The table reads our LLM API price tracker, which records list prices every day for the five newest paid text models from each lab it follows, taken from OpenRouter and the labs' published prices. The date above the table shows the last update. Prices are per million tokens, before caching, batch or volume discounts.

Embed this tool

Free to use on your own site, newsletter or course page. Paste this where you want the tool to appear; it keeps working as the tool improves.

<iframe src="https://gravity.fast/tools/token-counter/?embed=1" width="100%" height="1100" style="border:1px solid #E5E1D7;border-radius:16px" title="Token counter and LLM cost calculator (free tool by Gravity)" loading="lazy"></iframe>
<p>Free <a href="https://gravity.fast/tools/token-counter/">Token counter and LLM cost calculator</a> by Gravity.</p>

More free tools