Two GPT encodings
Switch between GPT-4o’s o200k_base tokenizer and GPT-4’s cl100k_base tokenizer without leaving the page.
Count GPT-4o and GPT-4-compatible tokens, then estimate API input or output cost without sending text anywhere.
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.
Switch between GPT-4o’s o200k_base tokenizer and GPT-4’s cl100k_base tokenizer without leaving the page.
Use the rate toggle to plan the prompt side or the generated-response side of an API request.
Your text remains in the browser while the local tokenizer calculates counts and estimates.
Paste a prompt, draft response, or document into the local text box.
Switch the model selector to choose the o200k_base or cl100k_base count.
Read the token total and use the input or output cost toggle for a per-call list-price estimate.
GPT-4o uses the o200k_base encoding in this calculator. GPT-4 uses cl100k_base. Select either model to see the local count for its supported encoding.
No. Token counting happens in your browser with gpt-tokenizer. Tokens Calculator does not upload, store, or inspect the text you enter.
Yes. API providers commonly price input and output tokens separately. Use the Input and Output toggle to apply the matching configured list rate to the count you see.
It is a text-token estimate. API requests can add tokens for messages, tools, images, system instructions, or cached content that are not present in your pasted text.
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.