Estimate how many tokens your text is.
Paste text or drop a file to get a token estimate, the characters and words behind it, and how much of each Claude model's context window it would take.
Runs in your browser. Whatever you drop or paste here is read by JavaScript in this tab and never sent anywhere. There is no upload endpoint on this site to send it to.
This is an estimate. It is produced by a heuristic that splits text the way a tokenizer roughly does — not by a real tokenizer. Expect it to land within about 10–15% for English prose and ordinary source code, and further out for dense punctuation, long encoded strings, or languages written without spaces. For a number you can budget against, ask the model's own API: Anthropic's count_tokens endpoint returns the exact input count for a named model.
A token is a chunk of text the model treats as one unit — usually a common word, a word fragment, or a piece of punctuation. English averages roughly four characters per token, but that average hides a lot: code counts higher because indentation and punctuation are not free, and text in a language written without spaces counts much higher again. If you want to know what a specific rules file is costing you every session, the CLAUDE.md linter measures that as one of its checks.
Common questions
How accurate is this estimate?
Within roughly 10–15% for English prose and ordinary source code, and worse for anything unusual — dense punctuation, long base64 blobs, or languages written without spaces. It is an estimate produced by a heuristic, not the output of a real tokenizer, and the section above the fold says so rather than burying it here.
Why not just run the real tokenizer?
A tokenizer is a vocabulary of tens of thousands of learned merges, specific to a model family. Shipping one into a web page means shipping megabytes of vocabulary that goes stale each time a model changes its tokenizer — and it would still be wrong for every model it was not built for. An estimate that is honest about being an estimate is more useful than a precise-looking number for the wrong model.
How do I get an exact count?
Ask the model's own API. Anthropic exposes a count_tokens endpoint that takes your messages and returns the exact input token count for a named model. That is the only number that is authoritative, because it is produced by the same code that will process the request.
Why does the same text cost different tokens on different models?
Because tokenizers differ between model families, and sometimes between generations of the same family. A model released after a tokenizer change can count the same paragraph noticeably differently from its predecessor, which is why token budgets are worth re-measuring after a model switch rather than carried over.
What is a token, roughly?
A chunk of text the model treats as one unit — usually a common word, a word fragment, or a piece of punctuation. Frequent words are a single token; rare ones get split into several. As a rule of thumb English runs about four characters per token, but that average hides a lot.
This page counts the text you paste into it. It cannot see the rest of your Mac — a browser is not allowed to, which is the whole reason this page is safe to use. Inventory is the desktop app that does: it indexes every conversation Cursor, Claude Code, Zed, Codex, Kiro and Antigravity have had on your machine and searches all of them at once, privately, from ⌘⇧Space. $19.99 once, free for 7 days, no account.