Claude token counter
Paste a prompt and see roughly how many tokens it uses on each Claude model and what that costs. It's an estimate, and it says so: add your own API key for Anthropic's count.
Facts checked · sources linked inline
≈ 0 tokens
Not an exact count: see below for how to get one.
- Characters
- 0
- Words
- 0
| Model | Est. tokens | Est. input cost | Of context window |
|---|---|---|---|
| 0 | $0 | 0% | |
| 0 | $0 | 0% | |
| 0 | $0 | 0% | |
| 0 | $0 | 0% | |
| 0 | $0 | 0% | |
| 0 | $0 | 0% | |
| 0 | $0 | 0% |
One request's input, at standard API rates. Output, caching and batch discounts aren't included.
Get Anthropic's count with your own API key
The token counting endpoint is free, but it needs a key. Yours goes straight from this browser to api.anthropic.com along with your text. host0 never sees either, and the key is gone when you leave the page. Prefer a separate key you can revoke afterwards.
How the estimate works, and how far to trust it
The page splits your text the way tokenizers tend to: common words whole, long words in pieces, each Chinese or Japanese character on its own, punctuation apart. It then scales the result for the model. It's fitted against a public tokenizer, not against Claude's, which isn't published. The range is our judgement, not a measured error bar. Treat it as good enough for “will this fit?” and “roughly what will it cost?”, and expect it to be furthest off on code, non-English text and emoji.
The estimate covers your text alone. A real request adds a little: Anthropic's documented example of a short system prompt plus Hello, Claude counts as 14 tokens. Tool definitions add more, and thinking blocks from the current turn count too.
Count Claude tokens in code
For anything you'll act on, use the count_tokens endpoint with the model you plan to run. It takes the same input as a real message, including system prompts, tools, images and PDFs:
curl
curl https://api.anthropic.com/v1/messages/count_tokens \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"system": "You are a scientist",
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'
# {"input_tokens": 14}Python
import anthropic
client = anthropic.Anthropic()
response = client.messages.count_tokens(
model="claude-opus-5-5",
messages=[{"role": "user", "content": open("CLAUDE.md").read()}],
)
print(response.input_tokens)It's free, and it's rate limited on its own: 5,000 requests a minute on the Start usage tier at the time of writing. Recount when you change models: a count from before Claude Opus 4.7 won't carry over.
What the cost column means
- Input only, one request. At each model's standard API price. Output usually costs five times as much per token, and it depends on the answer, which nobody can count in advance.
- A long conversation resends its history. Each turn pays for everything before it again, unless prompt caching covers it, which makes a big system prompt much cheaper than this column shows.
- Claude Haiku 5.5's rate changes with size. $0.10 per million tokens up to 100,000 tokens, $0.50 per million for longer prompts.
For how these prices have moved, see the price of AI tokens, 2020–2026 and AI token spending in 2026.
Frequently asked questions
Is this an exact Claude token count?
No, not without an API key. Anthropic doesn't publish the tokenizer for current Claude models, so no tool can count exactly from text alone, whatever its page says. This one estimates and labels it as an estimate. With your own key you get the number from Anthropic's count_tokens endpoint, which is the closest thing there is. Anthropic itself notes that even that can differ from a real request by a small amount.
How many tokens is a word in Claude?
There's no fixed ratio. Common short English words are usually one token, long or rare words are several, and code, numbers and non-English text use more tokens per character than English prose. That's why a count per model beats a rule of thumb like “four characters per token”.
Why do the numbers differ between Claude models?
Claude 4.7 and later models use a newer tokenizer, and Anthropic says the same text produces approximately 30 percent more tokens on them than on earlier models. A cheaper per-token price on a newer model can be partly offset by that, so compare the cost column rather than the price alone.
Can I use tiktoken to count Claude tokens?
Not accurately. tiktoken is OpenAI's tokenizer, and its counts are for OpenAI models. It splits text differently from Claude's, so use it only as a rough guide.
Does token counting cost anything?
No. Anthropic's token counting endpoint is free to use, with its own rate limit per minute by usage tier, separate from sending messages. You still need an API key, and that means a Claude Console account.
Does this count images and PDFs?
No, this page counts text only. Images and PDFs are tokenized differently: to count one, send it as base64 to the count_tokens endpoint, as in the example above.
Is my text sent anywhere?
The estimate runs in this browser tab and sends nothing. Count with Anthropic sends your text and key directly from your browser to Anthropic, the same way your own code would. Neither passes through host0.
Related free tools
See all free tools →Built something? Put it online in seconds
host0 hosts whatever your agent created: bring any coding agent, build the tool only you need — like this one — and say "deploy to host0". Live at a shareable URL, no servers to run.