AI Token Counter and GPT Tokenizer
Free token counter for GPT-5, GPT-4o and GPT-4: exact o200k and cl100k counts, a view of how your text splits into tokens, and Claude and Gemini estimates.
0 tokens
Exact count with o200k_base
| Model family | Tokens |
|---|---|
| GPT-5, GPT-4.1, GPT-4o, o-serieso200k_base, exact | – |
| GPT-4, GPT-4 Turbo, GPT-3.5 Turbocl100k_base, exact | – |
| Claude estimatecharacters ÷ 3.5, up to 35% more on Claude Opus 4.7 and newer | 0 |
| Gemini estimatecharacters ÷ 4 | 0 |
Claude and Gemini figures are rules of thumb for English text, not tokenizer counts. For exact numbers use Anthropic's count_tokens endpoint or Gemini's countTokens method.
See the tokens
Each coloured block is one token, and a bar marks where it ends. · is a space, → a tab, ↵ a line break. A dashed box is a character whose bytes are split across several tokens.
| # | Token | ID |
|---|
How to use the token counter
Paste or type your prompt, or open or drop a plain-text file (.txt, .md, .csv, .json or source code). The big number is the exact token count for the tokenizer you pick, and the table compares the other models. Under See the tokens you can view the text as coloured tokens, as a token list, or as the raw token IDs, which you can copy or download as JSON.
What a token is
Language models read tokens, not letters or words. OpenAI models use byte-level byte pair encoding (BPE). The text is first cut into chunks by a regular expression: a word together with the space before it, up to three digits, a run of punctuation, or whitespace. Each chunk becomes UTF-8 bytes, and neighbouring bytes are merged, most frequent pair first, until only pieces from the vocabulary are left. A common English word is one token including its leading space, while a rare word, a long number or most non-English text splits into several. An emoji or a Chinese character can take two or three tokens, and a token can even hold only part of a character’s bytes; those pieces are shown in a dashed box.
Which tokenizer each model uses
| Tokenizer | Vocabulary | Models |
|---|---|---|
| o200k_base | about 200,000 tokens | GPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini |
| cl100k_base | about 100,000 tokens | GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, text-embedding-3 |
Counts here match OpenAI’s tiktoken library token for token. Like its
encode_ordinary, special markers such as <|endoftext|> typed into the
text count as ordinary text. The open-weight gpt-oss models use
o200k_harmony, which only adds special tokens to o200k_base, so plain text
gives the same count.
Claude and Gemini estimates
Anthropic and Google don’t publish tokenizers for their current models that can run in a browser, so this page estimates from the character count using each company’s rule of thumb: about 3.5 characters per token for Claude and about 4 for Gemini. Anthropic says the tokenizer introduced with Claude Opus 4.7 can use up to 1.35 times as many tokens as earlier Claude models for the same text, so the Claude estimate is a range. The rules describe English prose. Code, numbers and non-Latin scripts need more tokens per character, and the page warns you when most of your text is not in the Latin alphabet.
For an exact figure, send the text to Anthropic’s
POST /v1/messages/count_tokens endpoint or the Gemini API’s countTokens
method, naming the model you plan to use.
Why an API request uses more tokens
- Chat requests wrap each message in role markers, which adds a few tokens per message, plus the system prompt and any tool definitions.
- Images, audio and files are counted separately.
- Output tokens, and reasoning tokens on reasoning models, are billed on top of the input.
Tips for fewer tokens
- Numbers split into groups of up to three digits, so long IDs, hashes and base64 strings are expensive. Leave them out when the model doesn’t need them.
- Pretty-printed JSON and wide Markdown tables cost more than the same facts in plain sentences.
- Watch Characters per token. English prose usually lands around 4 to 5 with these tokenizers, and a much lower number points to text that is costly to send.
Frequently asked questions
Is my text uploaded anywhere?
No. The tokenizer data (about 1 MB) is downloaded from this site once, and the counting runs in your browser. Your text and files never leave your device.
How many words is 1,000 tokens?
About 750 English words with the OpenAI tokenizers, following OpenAI’s rule of thumb that one token is roughly three quarters of a word. Other languages and code fit fewer words into the same number of tokens.
Why does the API report more input tokens than this counter?
The API counts the whole request. Each chat message adds a few tokens of formatting, and the system prompt, tool definitions, images and files count too. This page counts the text you give it.
Can this count Claude or Gemini tokens exactly?
No. Those tokenizers aren’t published for use in a browser, so the page shows labelled estimates. Anthropic’s count_tokens endpoint and Gemini’s countTokens method return exact counts for a given model.
Why do emoji and Chinese text use so many tokens?
The tokenizers work on UTF-8 bytes. A Chinese character is 3 bytes and many emoji are 4 or more, and characters that are rare in the training data are not merged into a single token, so each can cost two or three tokens.