▸ Free tool
Token Counter.
Paste text, get an instant estimate of how many tokens it costs across Claude and GPT models. Nothing leaves your browser.
▸ Estimate, not exact
Uses the ~4 chars/token heuristic. Real tokenizers vary ±10-20%. For billing precision, count with the provider's tokenizer.
▸ Estimate
- ~ Tokens
- 0
- Characters
- 0
- Words
- 0
As input, once
- Claude Opus$0
- Claude Sonnet$0
- GPT-5.5$0
- GPT-5.4 mini$0
A token is not a word
Tokenizers are trained, not designed. Byte Pair Encoding starts from raw bytes and repeatedly merges the most frequent adjacent pair until it has a vocabulary of somewhere between 50,000 and 200,000 entries. What comes out is a table of subword fragments: common English words survive as a single token, rarer ones come apart into stem and suffix, and anything the training corpus barely saw falls back toward individual bytes.
Two consequences catch people out. The leading space is usually part of
the token, so hello and " hello" are different entries and gluing strings together can change the count.
And modern tokenizers are byte-level, so there is no unknown-token failure
case — everything encodes, some things just encode expensively.
Where four characters per token falls apart
The ~4 chars/token rule comes from English prose and holds up there. Everywhere else it leaks:
- Code. Identifiers are not vocabulary entries —
getUserByIdsplits into several fragments, and every bracket, operator, and dot is a token of its own. Real source usually lands nearer three characters per token. - JSON. Braces, quotes, colons, and commas are all tokens, and every record repeats every key. A 200-row API response spends a serious share of its budget re-stating field names.
- Whitespace. Newer OpenAI vocabularies added multi-space tokens precisely because indented Python was brutal under the GPT-2 tokenizer, where a run of indentation cost roughly one token per space. Which tokenizer you are on decides what your formatting costs.
- High-entropy strings. UUIDs, hashes, base64 blobs, minified bundles. There are no useful merges to find, so they shatter — a single UUID can cost more than a dozen tokens.
- Non-Latin scripts. A Chinese or Japanese character often costs a full token on its own, against roughly four English characters per token. Arabic, Hebrew, and Devanagari usually do worse, fragmenting toward individual UTF-8 bytes. Per character, that is several times the price for the same meaning.
Counts do not port between model families
There is no universal token. Every model family ships its own tokenizer,
and a bigger vocabulary means fewer tokens for the same string — which
is why the same paragraph can differ by a double-digit percentage across
providers, and by much more if it is not English. OpenAI publishes
tiktoken (cl100k_base for the GPT-4 generation, o200k_base for newer models). Anthropic does not publish Claude's tokenizer and gives
you a count_tokens endpoint on the Messages
API instead. Google exposes countTokens for Gemini. Open-weight models ship their tokenizer with the checkpoint,
so AutoTokenizer gives you an exact count
locally.
So a count measured on one model is an estimate on every other one. Migrating a prompt across providers can quietly change both your bill and whether it still fits.
Tokens are the unit of your bill and your window
Both limits that matter are denominated in tokens, and neither one is measured in characters. Pricing is per million input and output tokens, with output typically several times the price of input. The context window is a token budget shared by the system prompt, tool definitions, retrieved chunks, conversation history, the user turn, and the reply — so every token you spend on context is one the model cannot spend on an answer. Prompt caching, embedding limits, and rate limits are all measured the same way.
Which is why a text-only count is a floor, not a total. Tool and function schemas are serialised into the request and billed as input. Images are converted to tokens based on their dimensions. Neither shows up in the box above.
When to stop estimating
Estimates are for sizing decisions: is this prompt roughly 2k tokens or roughly 200k, is this chunk in the right ballpark, is this feature going to cost cents or hundreds. The moment a number becomes load-bearing, switch to the real tokenizer — before a budget forecast at volume, before anything that can hard-fail on a context limit in a batch job, before you settle on a chunk size for a vector index, and always when the content is code, JSON, or a non-Latin script.
| This page's estimate | The provider's tokenizer | |
|---|---|---|
| What it does | Blends chars ÷ 4 with a word-count estimate | Runs the model's real merge table |
| Where it runs | In this tab, as you type | An API call or a local library |
| English prose | Usually within 10–20% | Exact |
| Code and JSON | Undercounts | Exact |
| Chinese, Japanese, Arabic | Undercounts, often by 3× or more | Exact |
| Counts images and tool schemas | ||
| Portable across model families | ||
| Use it for | Sizing a prompt, sanity checks | Billing, hard limits, chunking |
Questions, answered
How accurate is this token counter?
It is a heuristic, not a tokenizer. The page blends the four-characters-per-token rule with a word-based estimate, which lands within roughly 10–20% for ordinary English prose and drifts much further for code, JSON, and non-Latin scripts. Use it to size a prompt or sanity-check a chunking strategy, and use the provider's own tokenizer before you commit to a billing forecast or a hard context limit.
How many tokens is 1,000 words?
Roughly 1,300 to 1,400 tokens for ordinary English prose, since the working ratio is about 0.75 words per token or four characters per token. Documentation and marketing copy sit close to that. Code, JSON, and tables run well above it for the same word count, and Chinese or Arabic can multiply it several times over.
Why does my code use more tokens than the estimate?
Because source code has almost none of the properties the four-characters-per-token rule assumes. An identifier like getUserById is not a vocabulary entry, so it splits into several subword fragments, and brackets, operators, and punctuation are tokens in their own right. High-entropy strings are the worst case: UUIDs, hashes, and base64 blobs have no useful merges and shatter into something close to one token per character or two.
Do Claude and GPT count tokens the same way?
No. Each model family ships its own tokenizer with its own vocabulary and merge table, so the same paragraph produces different counts on each one. OpenAI publishes tiktoken, with cl100k_base for the GPT-4 generation and o200k_base for newer models; Anthropic does not publish Claude's tokenizer and exposes a count_tokens endpoint on the Messages API instead; Google offers countTokens for Gemini. A number you measured on one model is only an estimate on any other.
Does Chinese, Japanese, or Arabic text cost more tokens?
Yes, usually several times more per character. Tokenizer vocabularies are dominated by English, so English prose compresses to about four characters per token while a Chinese or Japanese character often costs a full token on its own. Arabic, Hebrew, Thai, and Devanagari tend to fragment further, sometimes down to individual UTF-8 bytes. Larger vocabularies like o200k_base narrowed that gap but did not close it, so budget extra context and extra money for non-English workloads.
Does this token counter send my text anywhere?
No. The estimate runs entirely in your browser, so the text never leaves the page, there is no request, and there is no server that could log it. Open the network tab and watch it stay empty, or load the page once and then go offline.
Keep going
-
▸ Tool
LLM Cost Calculator
Turn a token count into a monthly bill: requests, input and output split, and a model price.
-
▸ Tool
Context Window Checker
Will the prompt fit, and how much of the window is left for the answer once retrieval and history land?
-
▸ Tool
RAG Chunk Splitter
See how a document splits, how big each chunk is, and how much overlap you pay to embed twice.
-
▸ Post
Context window vs memory
Why a bigger window is not memory, and what actually falls out of the prompt between turns.
-
▸ Post
Prompt vs context engineering
Wording is the small half of the job. Deciding what gets into the token budget is the big half.
Keep reading
-
▸ Tool
LLM Cost Calculator
Tokens are the unit. This turns them into a monthly bill.
-
▸ Tool
Context Window Checker
Will it fit? Headroom left across Claude, GPT and Gemini windows.
-
▸ Tool
RAG Chunk Splitter
Split a document into retrieval chunks and see each chunk's token count.
-
▸ Post
/blog/context-window-vs-memory/
Why a bigger context window is not the same thing as memory.