GPT token counter
Paste a prompt and get the exact token count for OpenAI's GPT models, the cost of a request and how much of the context window it uses. Nothing is uploaded.
How to use the GPT token counter
- Paste your prompt or document, or drop a text file on the editor.
- Read the exact token count at the top right.
- Set the expected answer length and the number of requests.
- Compare the cost of each GPT model in the table.
What you get
- Exact counts with the o200k tokenizer (GPT-4o onwards)
- Input and output cost per request
- Total for a thousand requests, or any number you choose
- Context window use for each model
About the GPT token counter
Exact, not estimated
OpenAI publishes its tokenizer, so this page splits text exactly as the API does for models from GPT-4o onwards. Turn on Show tokens to see each piece.
Messages add a little
Chat requests add a few tokens per message for roles and formatting, and tools or images add more. Treat the count as the text's share of the request.
Frequently asked questions
- Which tokenizer do GPT models use?
- Models from GPT-4o onwards use o200k_base. Older GPT-4 and GPT-3.5 models used cl100k_base, which gives slightly different counts.
- Why is my count different from the API?
- The API also counts message formatting, system prompts, tools and images. The text itself counts the same.
- Is my prompt uploaded?
- No. Counting runs in your browser.