Token counter
Exact token counts for OpenAI’s o200k tokenizer, computed in your browser. See where the text splits, whether it fits a context window, and what it costs to send.
Context window fit
- 8,1920.00%
- 32,0000.00%
- 128,0000.00%
- 200,0000.00%
- 1M0.00%
Cost to send
This text costs $0.00000 per request, or $0.00 per 1,000 requests. Check your provider’s current price sheet.
What is a token?
Language models don’t read letters or words. They read tokens: chunks of text from a fixed vocabulary learned by byte-pair encoding. Common words are one token (“ the”, “ prompt”); rarer words split into pieces (“ token”, “izer”). The leading space is usually part of the token, which is why the coloured boundaries above often start with a space.
Keeping prompts tight is less about saving fractions of a cent and more about focus: every irrelevant paragraph competes for the model’s attention. The prompt optimizer helps you cut what isn’t pulling its weight.
Questions
How accurate is this token counter?
For OpenAI models that use the o200k_base tokenizer (GPT-4o, GPT-4.1, o-series and the GPT-5 family), the count is exact: it runs the same byte-pair encoding locally in your browser via the open-source gpt-tokenizer library. Other vendors use different tokenizers, so the Claude figure is labelled as an estimate.
How many tokens is a word?
For English text, a token is roughly four characters, or about three quarters of a word, according to OpenAI’s own rule of thumb. So 1,000 tokens is around 750 words. Code, numbers and non-English languages use more tokens per word.
Why does the Claude estimate differ?
Anthropic’s tokenizer splits text differently from OpenAI’s and is not published as a browser library. For typical English prose it produces somewhat more tokens, so the tool shows the OpenAI count plus about 15%. For an exact figure, use Anthropic’s token counting API.
Is my text uploaded?
No. Tokenization happens entirely in your browser. The text is kept in localStorage only so it survives a reload.
Why do tokens matter for prompts?
Every model has a context window, the maximum tokens it can read and write in one go, and API pricing is per token. Long prompts cost more, are slower, and can crowd out room for the answer.
More tools in the studio
- GeneratorPrompt GeneratorSet a text prompt from role, task, context, format and constraints.
- OptimizerPrompt OptimizerScore any prompt on 8 checks, then rewrite it and compare.
- ChatGPTChatGPT Prompt GeneratorMarkdown-sectioned prompts tuned for ChatGPT.
- ClaudeClaude Prompt GeneratorXML-tagged prompts the way Anthropic recommends.
- SystemSystem Prompt GeneratorInstructions for custom GPTs, assistants and agents.
- ImageImage Prompt GeneratorNatural-language prompts for Flux, GPT Image, DALL·E and Imagen.
- MidjourneyMidjourney Prompt BuilderDescriptors plus --ar, --stylize, --chaos and more.
- Stable DiffusionStable Diffusion Prompt GeneratorWeighted tags, negative prompt, CFG and steps.
- VideoVideo Prompt GeneratorShot-by-shot prompts for Sora, Veo, Runway and Kling.