Wapgee Logowapgee

Token Counter & LLM Cost Calculator

Paste any prompt or document to see how many tokens it uses and what it would cost to send to Claude, GPT, or Gemini, before you make the API call.

Input - prompt or document
11 lines 575 chars 93 words
Tokens204
Words93
Chars575
ModelPer callMonthly
Claude Haiku 4.5Anthropic$0.0052$52
Gemini 1.5 FlashGoogle · cheapest$0.0003$3
GPT-4o miniOpenAI$0.0006$6
Claude Sonnet 5Anthropic$0.0104$104
GPT-4oOpenAI$0.0105$105
Claude Opus 5Anthropic$0.0260$260

Estimates use each provider's published API prices (last reviewed August 2026) and the expected output length above. Tokenizers differ slightly per model; this page counts with the open o200k tokenizer in your browser. The prompt is never sent to an API.

What a token is

Language models do not read characters or words. They read tokens: chunks produced by a tokenizer that splits text into pieces it has seen often. Common English words are usually one token, a longer or rarer word is two or three, punctuation is often its own token, and code is split at operators and indentation. A rough rule is four characters or three quarters of a word per token in English, but the ratio moves a lot with the kind of text.

Text
The quick brown fox jumps over the lazy dog.
Tokens (approximate)
The| quick| brown| fox| jumps| over| the| lazy| dog|.
= 10 tokens for 44 characters

Every API bills per token, separately for input and output, so tokens are the unit that decides what a prompt costs and whether it fits in the context window at all.

How this counter works

The count runs in your browser. The text is split with the o200k pre-tokenizer pattern, the encoding used by GPT-4o and related models, and each piece is sized by its byte length. That gives a count within a few percent of the real GPT tokenizer without shipping a multi-megabyte vocabulary to the page, and your prompt never leaves your machine.

Claude and Gemini use their own tokenizers, so their true counts differ slightly, usually by well under ten percent on English prose and a little more on code. For choosing a model and estimating a monthly bill that is more than close enough; for a hard context limit, leave a margin.

Reading the cost table

The table lists each model with its input price, its output price, and what your pasted text would cost as input. Prices are quoted per million tokens, which is how the providers publish them, and you can switch the currency between USD, EUR, and GBP. Output is priced separately and is usually several times more expensive than input, so a prompt that asks for a long answer costs more on the way back than on the way in.

For a one-off call the numbers look like rounding errors. The calculator earns its place when you multiply: a 3,000-token system prompt sent on every one of 50,000 daily requests is 150 million input tokens a day, and at that scale the gap between a small model and a flagship is a real line on an invoice.

Ways to cut a prompt down

  • Convert web pages to Markdown before pasting them. Markup and scripts are most of the bytes in HTML; the HTML to Markdown tool typically removes 70 to 90 percent of them.
  • Prefer YAML or compact JSON over pretty-printed JSON for structured data. Indentation whitespace is tokens too.
  • Trim chat history. Every turn is re-sent on every call, so a long conversation grows quadratically in total tokens billed.
  • Move stable instructions into a cached system prompt where the provider supports prompt caching, which prices repeated input tokens at a discount.
  • Ask for the output format you need and nothing else. A JSON answer without prose around it is cheaper and easier to parse.

Paste before and after each change to see the difference; the count updates as you edit.

Tokens and context windows

A context window is the maximum number of tokens a model can hold at once, counting the system prompt, the conversation so far, any documents you attach, and the answer it is about to write. Exceeding it produces an error or silently truncated input. Because the window is shared, a 180,000-token document in a 200,000-token window leaves only 20,000 for instructions and the reply. Count large documents here first and decide whether to chunk them.

Where the prices come from

Prices are taken from the public pricing pages of each provider and stored as a small table in this site, so updating them is an edit rather than a release. Providers change list prices a few times a year and often price long-context requests or batch calls differently, so treat the table as the standard on-demand rate and check the provider page before committing to a budget.

FAQ

Why count tokens before sending?

LLM APIs bill per token, in and out. A prompt that "feels short" can easily be thousands of tokens once you paste in a document, and at 10,000 calls a month the difference between models is real money. Counting first turns pricing from a surprise into a decision.

What counts as a token?

Roughly 3/4 of an English word, but it varies: code, JSON, and non-English text tokenize less efficiently. That's why this tool counts your actual text instead of applying a words x 1.3 rule of thumb.

Is my prompt sent to any API to be counted?

No. Counting runs in your browser with an open tokenizer (o200k, the encoding used by GPT-4o and similar models). Your text never leaves the page. Other providers tokenize a little differently, so treat the count as a close estimate across Claude and Gemini.

Where do the prices come from?

The providers' public API price lists, reviewed monthly. The date of the last review is shown next to the table.

Does it handle system prompts and chat history?

Yes. Paste the whole conversation. For multi-turn chats, remember the full history is re-sent (and re-billed) on every call.