Count tokens, words and characters for OpenAI models, right in your browser.
Paste any text to count its tokens with OpenAI's tokenizers, plus words and characters. Counting happens in your browser; the text is not sent anywhere.
Show how the text splits into tokens
Which tokenizer to pick
OpenAI models break text into tokens with byte-pair encodings published in its open-source tiktoken library. The library maps each model to an encoding: GPT-4o and newer OpenAI models use o200k_base, while GPT-4 and GPT-3.5 Turbo use cl100k_base. If you are not sure, leave o200k_base selected.
The count covers the text only. When you send a chat request, the API adds a few tokens per message for roles and formatting, so a request's billed input can be slightly higher than the count of the text itself.
Claude and Gemini count tokens differently
Anthropic and Google use their own tokenizers, so the same text gives a different number of tokens in Claude or Gemini. This page does not guess those numbers. For exact counts, use the vendors' own tools:
| Model family | How to get an exact count |
|---|---|
| Claude | The token counting endpoint in the Claude API, described in Anthropic's token counting docs. |
| Gemini | The countTokens method in the Gemini API, described in Google's guide to tokens. |
How the counter works
The page loads gpt-tokenizer, an open-source JavaScript port of tiktoken's encodings, and runs it on your device. Words are counted as runs of letters and numbers separated by spaces or punctuation; characters are counted as Unicode characters, so an emoji counts as one.
Looking for something else? See the AI plan limits tracker or the prompt library.
