Tokens Calculator

OpenAI Token Calculator

Count GPT-4o and GPT-4-compatible tokens, then estimate API input or output cost without sending text anywhere.

o200k_base
0 / 1,000,000 characters

Token visualization

Local token pieces update 0.5 seconds after you stop typing.

0 tokens

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 configured model costs

Compare the same text using the available local encodings and current list-price estimates.

Edit text
ModelTokensInput / 1MInput cost
GPT-4oOpenAI0$2.50$0.000000
GPT-4OpenAI0$30.00$0.000000
Claude 3.5 SonnetAnthropic0$3.00$0.000000
Claude Sonnet 4.6Anthropic0$3.00$0.000000
Gemini 2.5 FlashGoogle0$0.30$0.000000
Gemini 2.5 ProGoogle0$1.25$0.000000

Claude and Gemini counts are useful approximations using cl100k_base; provider tokenizers can differ by model version and text.

Two GPT encodings

Switch between GPT-4o’s o200k_base tokenizer and GPT-4’s cl100k_base tokenizer without leaving the page.

Separate input and output

Use the rate toggle to plan the prompt side or the generated-response side of an API request.

No prompt upload

Your text remains in the browser while the local tokenizer calculates counts and estimates.

How it works

  1. 01

    Paste your text

    Paste a prompt, draft response, or document into the local text box.

  2. 02

    Choose GPT-4o or GPT-4

    Switch the model selector to choose the o200k_base or cl100k_base count.

  3. 03

    Estimate your API usage

    Read the token total and use the input or output cost toggle for a per-call list-price estimate.

OpenAI Token Calculator FAQ

Which OpenAI encodings does this calculator use?

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.

Does the OpenAI token calculator upload my prompt?

No. Token counting happens in your browser with gpt-tokenizer. Tokens Calculator does not upload, store, or inspect the text you enter.

Are input and output token prices different?

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.

Will this match an API request exactly?

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.

Not affiliated with Anthropic, OpenAI or Google.