Contextwaise

Token counter

Count the tokens in a prompt for Claude, GPT, Gemini and DeepSeek, see how much of the context window it fills, and what it costs at your volume. Free, and nothing leaves your browser.

0 characters0 words
ModelTokensPer callPer monthPer month, cached
Claude Opus 5.5
Estimate · $4 / 1M
0
0% of 1M
$0$0—
Claude Sonnet 5.5
Estimate · $2 / 1M
0
0% of 1M
$0$0—
GPT-6.1 Sol
Counted, o200k_base · $2 / 1M
0
0% of 1.05M
$0$0—
Gemini 3.1 Pro
Estimate · $2 / 1M
0
0% of 1.05M
$0$0—
DeepSeek V4 Pro
Estimate · $0.66 / 1M
0
0% of 1M
$0$0—
GPT-6 Luna
Counted, o200k_base · $0.1 / 1M
0
0% of 1.05M
$0$0—

Input tokens only, at list prices; output is billed separately. A month is 30 days. “Cached” applies from 2 agent steps: it writes this text to the prompt cache on the first step and reads it on the rest (Claude needs cache breakpoints for that).

Claude, Gemini and DeepSeek counts use each provider's published characters-per-token ratio, so expect them to be off by 10 to 20%. For an exact count, use the provider's count endpoint (below).

What is a token?

A token is the unit a language model reads and bills: a word, part of a word, a punctuation mark or a space. In English, a token averages about 4 characters, or three quarters of a word, on OpenAI and Gemini models.

Models never see letters. A tokenizer cuts the text into pieces from a fixed vocabulary, and the model works on those pieces. Common words are one token; rare words, names and numbers are split into several.

TextOpenAI, GeminiClaude (current tokenizer)
1 token~4 characters, ~0.75 words~2.5 characters, ~0.55 words
1,000 words~1,300 tokens~1,800 tokens
1M-token context window~750,000 words~555,000 words

Code, JSON, URLs and languages other than English use more tokens per word, because the vocabulary has fewer ready-made pieces for them.

Why Claude, GPT and Gemini count differently

Each provider trains its own tokenizer, so the same text is a different number of tokens on each model. Compare prices per token only after counting on that model.

Count tokens in your code

For exact numbers in production, each provider has an endpoint that counts a request the way the model will see it, including the formatting around messages and tools.

Claude, with the Anthropic SDK:

TypeScript
const { input_tokens } = await anthropic.messages.countTokens({
  model: "claude-opus-5-5",
  messages: [{ role: "user", content: prompt }],
});

OpenAI, with the input token count endpoint:

Terminal
curl https://api.openai.com/v1/responses/input_tokens \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6.1-sol", "input": "Your prompt"}'

Or offline in Python with tiktoken:

Python
import tiktoken
tokens = len(tiktoken.get_encoding("o200k_base").encode(text))

Gemini, with the Google Gen AI SDK:

TypeScript
const { totalTokens } = await ai.models.countTokens({
  model: "gemini-3.1-pro-preview",
  contents: prompt,
});

What a prompt really costs

A token count turns into a bill three ways, and the counter above shows all three.

  1. Per call: tokens × the input price. A 20,000-token prompt on a $2 per 1M model is 4 cents.
  2. At volume: the same 4 cents at 1,000 calls a day is $1,200 a month.
  3. In an agent: each step resends everything before it, so the same context is billed again and again. Set the agent steps above to 20 and watch the monthly figure.

Prompt caching softens the third: after the first call, the repeated prefix is billed at 3 to 10% of the input price, depending on the model. The prompt caching guide covers what breaks a cache, and the LLM cost guide covers the rest of the bill.

How to use fewer tokens

In most production prompts, the instructions are small and the context is large: retrieved documents, search results, tool output and chat history. That is where the tokens are, and most of it is never used by the answer.

Frequently asked questions

Is this token count exact?

For OpenAI models, yes for plain text: it runs o200k_base, OpenAI's open tokenizer, in your browser. OpenAI has not published the tokenizer for GPT-6, so treat it as very close rather than exact. Claude, Gemini and DeepSeek counts are estimates from each provider's published ratio. For an exact number, call the provider's count endpoint.

Is my text uploaded anywhere?

No. Counting runs in your browser. The text never leaves your machine, so you can paste private prompts and documents.

How many tokens is a word?

In English, about 1.3 tokens per word on OpenAI and Gemini models (100 tokens is roughly 75 words). Claude's current tokenizer splits finer: Anthropic says 1M tokens is about 555,000 words, so roughly 1.8 tokens per word.

Why does Claude count more tokens than GPT for the same text?

Each provider trains its own tokenizer. The one Anthropic introduced with Claude Opus 4.7 uses smaller pieces, about 2.5 characters per token against about 4 for OpenAI and Gemini. The same prompt is more tokens on Claude, which the per-token price has to be read against.

Does the system prompt count?

Yes. Everything you send is input: the system prompt, tool definitions, the chat history, retrieved documents and tool results. In a chat or an agent, all of it is sent again on every call.

Do output tokens cost more than input tokens?

Usually about 5 times more per token. This counter prices input, because input is where the volume is: a prompt with 20,000 tokens of context often produces an answer of a few hundred.

Cut your LLM costs
without cutting quality.

One layer between retrieval and inference removes the context your model never needed, in milliseconds. Fewer input tokens, lower cost, a prompt cache that keeps hitting, and every removal logged with its reason.

Keep your model, retriever and prompts. Remove one call to roll back.