Token Counter
Count the tokens of a prompt or document with the exact OpenAI tokenizers (o200k_base for GPT-4o and newer, cl100k_base for GPT-4 and GPT-3.5), and see characters, words and a rough estimate for other models. Useful for staying within context windows and estimating API costs.
Frequently asked questions
What is a token?
Language models read text as tokens, pieces of words produced by a tokenizer. In English a token is about four characters or three quarters of a word on average, but code, numbers and other languages use more.
Which tokenizers are exact?
o200k_base (GPT-4o, GPT-4.1, o1, o3, o4-mini), cl100k_base (GPT-4, GPT-3.5 Turbo, text-embedding-3), p50k_base and r50k_base (older GPT-3 and Codex models), counted with js-tiktoken, the JavaScript port of OpenAI's tiktoken.
What about Claude, Gemini or Llama?
They use their own tokenizers. The tool shows a heuristic estimate of one token per four characters, which is close for English prose; use the provider's token counting API for exact numbers.
Do special tokens count?
Yes. Text that looks like a special token, such as <|endoftext|>, is counted as that token, like the API would treat it.
Are chat messages counted with overhead?
No. The count covers the text only. Chat APIs add a few tokens per message for roles and formatting.
Is my text stored?
No. It is tokenized for this request only.