Vishal.
All tools

Free local tokenizer

Prompt Token Counter

Paste a prompt, system message, document, or code sample and count its tokens with real OpenAI-compatible tokenizers—without sending your text anywhere.

Exact selected encoding · No sign-up · Runs locally

Prompt input
Processed locally in your browser9 lines

Token analysis

Prompt footprint

Exact tokenizer count

40

tokens

28

Words

188

Characters

188

UTF-8 bytes

1.43

Tokens / word

Context window usage

128k context0.03%
1M context<0.01%

First token IDs

35755532611888249829186364170452360160629026695381413184329060523826253333+20 more

OpenAI-compatible tokenizers are counted exactly. Anthropic, Gemini, and other providers use different tokenizers, so their counts may vary. Chat APIs may also add message-format overhead.

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

01

Prompt text

Every character in the text area is encoded using the selected tokenizer, including whitespace, punctuation, code, and non-English characters.

02

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.

03

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.

04

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.