Token counter and AI API cost calculator

Paste a prompt or document to see its exact token count for OpenAI models and clearly marked estimates for Claude and Gemini, then work out what the API calls will cost.

  • 100% free
  • Runs in your browser
  • No uploads

Your text is saved in this browser only, so it's still here if you reload.

Tokens for GPT-4o, GPT-5 and newer OpenAI models

…

Exact, counted with OpenAI's o200k_base tokenizer.

GPT-4 and GPT-3.5 (cl100k_base)
…
Claude 4.7 and newer (estimate)
about 0
Claude Sonnet 4.6 and older (estimate)
about 0
Gemini (estimate)
about 0
Characters
0
Words
0

Claude and Gemini tokenizers aren't public, so those numbers use the providers' own rules of thumb. For an exact count, use the provider's token-counting API.

See how the text is split into tokens

API cost calculator

Input per request
Prices as of 11 October 2026, in US dollars per 1 million tokens (standard rate, text). Prices change: check the provider's pricing page before relying on them. You can edit any price.
ModelInput $ / 1MOutput $ / 1MInput tokensCost
GPT-6 Astra…$0.025
GPT-6.1 Sol…$0.005
GPT-6 Luna…$0.00025
GPT-5.6 Terra…$0.006
GPT-5.5…$0.015
GPT-5.4 mini…$0.00225
GPT-5…$0.005
GPT-5 mini…$0.001
GPT-5 nano…$0.0002
GPT-4.1…$0.004
GPT-4o…$0.005
GPT-4o mini…$0.0003
o4-mini…$0.0022
Claude Fable 5.1~0$0.025
Claude Opus 5.5~0$0.01
Claude Opus 5~0$0.0125
Claude Sonnet 5.5~0$0.005
Claude Sonnet 5~0$0.005
Claude Sonnet 4.6~0$0.0075
Claude Haiku 5.5~0$0.00025
Claude Haiku 4.5~0$0.0025
Gemini 3.8 FlashGoogle lists $1.50 input and $7.50 output from 1 January 2027.~0$0.001875
Gemini 3.5 Flash-Lite~0$0.00125
Gemini 3.1 Pro Preview~0$0.006
Gemini 3.1 Flash-Lite~0$0.00075
Gemini 2.5 Pro~0$0.005
Gemini 2.5 Flash~0$0.00125
Gemini 2.5 Flash-Lite~0$0.0002

Cost = input tokens × input price + output tokens × output price, divided by 1,000,000, times the number of requests. ~ marks an estimated token count. Cached input, batch discounts and tool or image charges aren't included. Official prices: OpenAI, Anthropic (Claude), Google (Gemini).

How to count tokens and estimate the cost

  1. Paste your text. A prompt, a system message, a document or a whole chat. Counts update as you type.
  2. Read the counts. The GPT numbers are exact. Claude and Gemini numbers are estimates and say so.
  3. Set the request. Use the pasted text as the input or type a token number, then enter the output tokens you expect and how many requests you'll make.
  4. Compare models. The table shows the cost for each model. Edit any price to match your plan or a newer rate.

Exact counts and estimates

GPT-4o, GPT-4.1, the o-series and GPT-5 use OpenAI's o200k_base tokenizer, and GPT-4 and GPT-3.5 use cl100k_base. Both run here with the same vocabulary files OpenAI publishes, so those counts match the API. OpenAI hasn't documented a different tokenizer for its newer models, so they're counted with o200k_base too.

For Claude, Anthropic says a token is about 3.5 English characters on models before Claude 4.7, and that Claude 4.7 and later use a newer tokenizer that produces about 30% more tokens for the same text. For Gemini, Google says a token is about 4 characters. Those rules describe English. For text mostly in other scripts, such as Chinese, Hindi or Arabic, the estimate is raised to at least the GPT count, because character rules badly undercount those languages.

How the cost is worked out

Providers charge separately for input (everything you send) and output (everything the model writes), per million tokens:

cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000 × requests

For example, GPT-5 is listed at $1.25 per million input tokens and $10 per million output tokens. A request with 2,000 input tokens and a 500-token answer costs 2,000 × 1.25 ÷ 1,000,000 = $0.0025 for input and 500 × 10 ÷ 1,000,000 = $0.005 for output, $0.0075 in total. A thousand such requests cost $7.50.

Some models charge a higher rate for the whole request once the input passes a threshold, such as 200,000 tokens for Gemini 2.5 Pro. The table switches to that rate automatically and says so.

Things that make the bill bigger than expected

  • Chat history is sent again every turn. In a conversation, each new request includes all the earlier messages, so input tokens grow with every reply.
  • Thinking counts as output. Reasoning models bill their hidden reasoning as output tokens, and output is the expensive side. Allow for it in the output number.
  • System prompts and tool definitions are input. A long system prompt is paid for on every single request.
  • Discounts aren't included. Cached input, batch processing and committed-use plans can cut the price a lot. Enter your own rate if you use them.

Frequently asked questions

Why are the Claude and Gemini counts only estimates?

OpenAI publishes its tokenizers, so they can run in your browser and give the exact number. Anthropic and Google don't publish theirs for offline use; they offer token-counting APIs instead, which would mean sending your text to them. The estimates use the rules of thumb in their own documentation.

Is my text sent anywhere?

No. The tokenizer runs in your browser. The text is kept in this browser's storage so it survives a reload, and you can turn that off under the text box.

Why does the same text give different counts for different models?

Each tokenizer has its own vocabulary of text pieces. A larger or newer vocabulary usually covers common words and other languages in fewer pieces, so GPT-4o and later need fewer tokens than GPT-4 for most text, while Claude's newer tokenizer produces more tokens than its older one.

Are the prices up to date?

They were copied from each provider's official pricing page on the date shown above the table. Prices change often, so check the provider's page before you budget, and type in any price that differs. Your edits are kept in this browser.

Does this count images, files or tool calls?

No, only the text you paste. Images, PDFs and tool definitions add their own tokens, and a chat app also adds formatting around each message, so a real request is usually a little larger.

Learn more