Tokenization guide
Why token count matters
LLMs process tokens rather than words. Token count determines whether content fits inside a context window and contributes directly to API cost. The same sentence can produce a different count across model families because their tokenizers split text differently.
What is included—and what is not
Prompt text
Every character in the text area is encoded using the selected tokenizer, including whitespace, punctuation, code, and non-English characters.
Message overhead
Chat APIs can add hidden formatting for roles, names, tool schemas, images, and message boundaries. This tool counts your visible text, not provider-side wrappers.
Generated output
The counter measures input only. Reserve context-window space and budget for the model's output, reasoning tokens, retrieved chunks, and conversation history.
Provider differences
An exact o200k count is not an exact Claude or Gemini count. Use provider-native counting endpoints when strict production limits matter.
Estimate API cost
Use your token count to compare OpenAI, Claude, and Gemini spend.
Plan RAG chunks
Turn document size into chunk, overlap, context, and storage estimates.
Frequently asked questions
How accurate is this prompt token counter?
It runs the selected OpenAI-compatible tokenizer directly in your browser, so the count is exact for that encoding. Chat APIs may add tokens for roles, message wrappers, tool definitions, images, and provider-specific formatting.
Which tokenizer should I choose?
Use o200k_base for modern OpenAI model families, cl100k_base for GPT-4-era models and many embeddings, and p50k_base for legacy code-oriented models. Confirm the tokenizer in your model's official documentation.
Can I use this for Claude or Gemini?
It can provide a rough comparison, but not an exact provider count. Anthropic and Google use their own tokenizers, and newer model generations may tokenize the same text differently.
Is my prompt uploaded or stored?
No. Tokenization runs entirely in your browser. The tool does not send your prompt to this website, a model provider, or an analytics endpoint.