Prompt Token Counter
Count tokens in pasted text with a real tokenizer.
Paste a prompt and count tokens with gpt-tokenizer’s o200k_base encoding, the one used by recent OpenAI models. It is an approximation. Claude, Gemini, and other models split the same text differently.
Tokens
—
Worked example
The sentence “Count the tokens in this prompt.” is counted with the o200k_base encoding. The number is the token length of that encoding, not a character count.
FAQ
- Which tokenizer is this?
- gpt-tokenizer, using o200k_base, which recent OpenAI models use. Claude and Gemini will not match it exactly.
- Do spaces and line breaks count?
- Yes, if the encoding gives them tokens. The count is of tokens, not of words.
- Is the number exact for my bill?
- Only if the provider uses this same encoding and you send this exact text. Tool messages, images, and system prompts are not included unless you paste them.