AI Tokenizer
Runs the real byte-pair encoding in your browser — o200k_base, cl100k_base, or p50k_base — instead of dividing the character count by four. That rule of thumb comes from English prose, and it is badly wrong about JSON, source code, and any script that is not Latin, which is most of what actually ends up in a production prompt. Shows every token boundary, what the text costs at a rate you set, and how much of a context window it consumes. Nothing is uploaded.
Downloading the vocabulary… The vocabulary is fetched once per encoding, then everything runs locally.
Tokens
Characters
Words
UTF-8 bytes
- Characters per token
- Tokens per word
- The ÷4 rule of thumb would say
- …which is out by
Cost
Rates move and differ per model, so this asks for the one you are actually billed.
- Once
- Across all calls
- Tokens across all calls
Input only. A reply is billed separately and usually costs several times as much per token, and anything you resend on every turn — a system prompt, a tool schema, a conversation history — is charged again each time unless it is being served from a prompt cache.
Context window
- Window used
- Remaining
- Copies that fit
The window holds the input and the reply, so a prompt that fills it leaves the model nothing to answer with.
Token breakdown
One chip per token. · is a space, ↵ a newline, → a tab.
Showing the first of tokens. The count above covers the whole text — only the chips are capped, because rendering a hundred thousand of them would lock up the tab.
What this actually tells you
A token is a byte-pair-encoded fragment, not a word and not a character. Common English words are usually one token each; a rare word, a variable name, a UUID, or a base64 blob breaks into several. That is why the ÷4 rule holds up on prose and falls apart on everything else — JSON keys, punctuation runs and indentation each cost a token, and characters outside the Latin scripts routinely cost one to three tokens each. Load the sample above and compare the paragraph against the JSON and the Japanese line.
These are OpenAI's tiktoken vocabularies, so the counts are exact for the models that use them: o200k_base for GPT-4o, GPT-4.1, the o-series and GPT-5; cl100k_base for GPT-4, GPT-3.5 Turbo and the text-embedding-3 models; p50k_base for GPT-3 and the legacy Codex models.
Claude is not on that list, deliberately. Anthropic does not publish a tokenizer for current Claude models, so no browser-side library can count them — anything claiming to is quietly showing you a GPT count. Use the API's POST /v1/messages/count_tokens endpoint, which is free to call and counts the whole request rather than a string. It matters more than it used to: Claude Opus 4.7 introduced a new tokenizer, also used by Opus 4.8 and Fable 5, that can emit up to about 1.35× as many tokens as the older Claude tokenizer on the same text, so a baseline taken against an earlier model does not carry forward.
Finally, this counts a string. A real request also carries the per-message chat framing, the system prompt, and every tool definition you declared — all billed as input, all counted against the window. Budget from the request, not from the paragraph.