Simple per-call math
The tool applies the listed per-million-token rate to the exact local count, so the calculation is easy to inspect.
Turn a local token count into a clear per-call API cost estimate for GPT, Claude, and Gemini model references.
Local token pieces update 0.5 seconds after you stop typing.
Paste text above to see how the selected local encoder splits it into tokens.
Local calculation. Your text stays in this browser. Nothing is uploaded or stored by Tokens Calculator.
Compare the same text using the available local encodings and current list-price estimates.
| Model | Tokens | Input / 1M | Input cost |
|---|---|---|---|
| GPT-4oOpenAI | 0 | $2.50 | $0.000000 |
| GPT-4OpenAI | 0 | $30.00 | $0.000000 |
| Claude 3.5 SonnetAnthropic | 0 | $3.00 | $0.000000 |
| Claude Sonnet 4.6Anthropic | 0 | $3.00 | $0.000000 |
| Gemini 2.5 FlashGoogle | 0 | $0.30 | $0.000000 |
| Gemini 2.5 ProGoogle | 0 | $1.25 | $0.000000 |
Claude and Gemini counts are useful approximations using cl100k_base; provider tokenizers can differ by model version and text.
The tool applies the listed per-million-token rate to the exact local count, so the calculation is easy to inspect.
See how a single text sample changes across the available GPT, Claude, and Gemini configurations.
Text is counted in your browser only, which keeps internal prompts and drafts out of a server-side log.
The calculator reads these standard USD list-price references from a single local configuration file. Provider policies, caching, tools, taxes, and special request modes can change the final bill.
| Model | Input / 1M | Output / 1M | Counting note |
|---|---|---|---|
| GPT-4oOpenAI | $2.50 | $10.00 | Uses the o200k_base encoding. |
| GPT-4OpenAI | $30.00 | $60.00 | Uses the cl100k_base encoding. |
| Claude 3.5 SonnetAnthropic | $3.00 | $15.00 | Legacy model; cl100k_base approximation. |
| Claude Sonnet 4.6Anthropic | $3.00 | $15.00 | cl100k_base approximation. |
| Gemini 2.5 FlashGoogle | $0.30 | $2.50 | cl100k_base approximation for text. |
| Gemini 2.5 ProGoogle | $1.25 | $10.00 | Uses standard pricing for prompts up to 200K; cl100k_base approximation. |
Paste a prompt or response that represents the text you expect to send or receive.
Pick the provider model whose list price you want to reference.
Use the mode switch to estimate the correct side of the API interaction.
It counts your pasted text with the selected local encoding, divides that count by one million, and multiplies it by the selected model’s configured input or output rate.
Most providers bill prompt tokens and generated tokens at different rates. Separating them avoids pretending a single pasted string represents both sides of a future API call.
The calculator does not add tokens from API message wrappers, system prompts, tool schemas, cached content, images, audio, discounts, taxes, or provider-specific service fees.
All rate references live in src/lib/pricing.ts. That central file keeps model names, encodings, price tiers, and official provider links together.
Every tool runs token counting in your browser. Keep your text local while you move between calculators and guides.
Not affiliated with Anthropic, OpenAI or Google.