Claude token counter
Paste a prompt, document or code to see its token count and what it costs as input and as output on each Claude model. Counting runs in your browser.
Estimate, not an exact count. Anthropic does not publish its tokenizer, so no website can count Claude tokens exactly offline. This page counts your text with OpenAI's public o200k_base tokenizer and applies Anthropic's documented ratio: about 30% more tokens on Claude Opus 4.7 and later (including every Claude 5 and Fable model), and roughly the same as o200k_base on Claude 4.6 and earlier (our assumption). For an exact number, use Anthropic's free token counting endpoint shown below.
The exact OpenAI tokenizer (about 1 MB) loads when you start typing.
This text is largely Korean, Japanese or Chinese. CJK text uses several times more tokens per character than English, and the gap between tokenizers is larger than for English, so treat non-OpenAI numbers as rough.
Cost of this text on Claude models
| Model | Tokens | As input | As output | × 1,000 |
|---|
Standard prices, no caching or batch discount. "As output" is what the same number of tokens costs if the model generates it. Long-context rates apply automatically when the text crosses a model's threshold. Full requests with caching and agent loops: calculator.
Claude tokenizer facts
| Tokenizer | Not published. Claude Opus 4.7 and later models use a newer tokenizer than earlier models. Source |
|---|---|
| Newer tokenizer | The same input text produces approximately 30 percent more tokens than on earlier models. The exact increase depends on the content. Fable 5.1, Fable 5 and the Mythos models share the tokenizer introduced with Opus 4.7. Source |
| Exact count | POST /v1/messages/count_tokens takes the same input as a Messages request (system prompt, messages, tools, images, PDFs) and returns input_tokens for the model you name. Source |
| Price of counting | Free. Rate-limited in requests per minute by usage tier: 5,000 (Start), 10,000 (Build), 20,000 (Scale). Counting and message creation have separate limits. Source |
| Accuracy of the endpoint | Anthropic calls the result an estimate: actual input tokens can differ by a small amount. Tokens Anthropic adds for system optimizations may be counted but are not billed. Source |
| Prompt caching | Token counting does not apply caching logic; caching only happens when a message is created. Source |
Checked against the linked official documentation on 2026-10-30.
Get the exact count from the official API
cURL
curl https://api.anthropic.com/v1/messages/count_tokens \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-5-5",
"system": "You are a scientist",
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'
# → {"input_tokens": ...}
Python
import anthropic
client = anthropic.Anthropic()
response = client.messages.count_tokens(
model="claude-opus-5-5",
system="You are a scientist",
messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(response.input_tokens)
Pass the model you will actually use: the endpoint counts under that model's tokenizer, so the same prompt returns about 30% more on Claude Opus 4.7 and later than on Claude Sonnet 4.6. Official documentation
Same text, different Claude models
Because of the tokenizer change, a text that is 10,000 tokens on o200k_base is estimated at a different count, and price, on each Claude model:
| Model | Tokenizer | Est. tokens | Input cost | Output cost |
|---|---|---|---|---|
| Claude Fable 5.2 | Claude 4.7 and later | 13,000 | $0.10 | $0.52 |
| Claude Fable 5.1 | Claude 4.7 and later | 13,000 | $0.13 | $0.65 |
| Claude Fable 5 | Claude 4.7 and later | 13,000 | $0.13 | $0.65 |
| Claude Opus 5.5 | Claude 4.7 and later | 13,000 | $0.05 | $0.26 |
| Claude Sonnet 5.5 | Claude 4.7 and later | 13,000 | $0.03 | $0.13 |
| Claude Haiku 5.5 | Claude 4.7 and later | 13,000 | $0.0013 | $0.0065 |
| Claude Opus 5 | Claude 4.7 and later | 13,000 | $0.07 | $0.33 |
| Claude Sonnet 5 | Claude 4.7 and later | 13,000 | $0.03 | $0.13 |
| Claude Opus 4.8 | Claude 4.7 and later | 13,000 | $0.07 | $0.33 |
| Claude Sonnet 4.6 | Claude 4.6 and earlier | 10,000 | $0.03 | $0.15 |
| Claude Haiku 4.5 | Claude 4.6 and earlier | 10,000 | $0.01 | $0.05 |
Estimates from Anthropic's "approximately 30% more tokens" statement; the real ratio depends on the content. Count a sample with the token counting endpoint on both models before migrating.
What Claude tokens cost
Cost of a given number of billed tokens on each model at standard rates (prices verified 2026-11-17):
| Model | 1K in | 1K out | 10K in | 10K out | 100K in | 100K out | Per 1M in / out |
|---|---|---|---|---|---|---|---|
| Claude Fable 5.2 | $0.0080 | $0.04 | $0.08 | $0.40 | $0.80 | $4.00 | $8.00 / $40.00 |
| Claude Fable 5.1 | $0.01 | $0.05 | $0.10 | $0.50 | $1.00 | $5.00 | $10.00 / $50.00 |
| Claude Fable 5 | $0.01 | $0.05 | $0.10 | $0.50 | $1.00 | $5.00 | $10.00 / $50.00 |
| Claude Opus 5.5 | $0.0040 | $0.02 | $0.04 | $0.20 | $0.40 | $2.00 | $4.00 / $20.00 |
| Claude Sonnet 5.5 | $0.0020 | $0.01 | $0.02 | $0.10 | $0.20 | $1.00 | $2.00 / $10.00 |
| Claude Haiku 5.5 | $0.00010 | $0.00050 | $0.0010 | $0.0050 | $0.01 | $0.05 | $0.10 / $0.50 |
| Claude Opus 5 | $0.0050 | $0.03 | $0.05 | $0.25 | $0.50 | $2.50 | $5.00 / $25.00 |
| Claude Sonnet 5 | $0.0020 | $0.01 | $0.02 | $0.10 | $0.20 | $1.00 | $2.00 / $10.00 |
| Claude Opus 4.8 | $0.0050 | $0.03 | $0.05 | $0.25 | $0.50 | $2.50 | $5.00 / $25.00 |
| Claude Sonnet 4.6 | $0.0030 | $0.01 | $0.03 | $0.15 | $0.30 | $1.50 | $3.00 / $15.00 |
| Claude Haiku 4.5 | $0.0010 | $0.0050 | $0.01 | $0.05 | $0.10 | $0.50 | $1.00 / $5.00 |
Long-context pricing: Claude Haiku 5.5 bills the whole request at 5× input and 5× output once the prompt exceeds 100,000 tokens. The output columns above assume a short prompt.
Per-model details: Claude Fable 5.2, Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Sonnet 5.5, Claude Haiku 5.5, Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, Claude Sonnet 4.6, Claude Haiku 4.5. Compare with other providers in the pricing table.
FAQ
Is this Claude token count exact?
No. Anthropic does not publish its tokenizer, so the count here is an estimate: the exact o200k_base count of your text × 1.3 for Claude Opus 4.7 and later (Anthropic documents about 30% more tokens on the newer tokenizer), and × 1 for Claude 4.6 and earlier (our assumption). For an exact number, call Anthropic's token counting endpoint with the model you plan to use.
Is the Claude token counting API free?
Yes. Anthropic's /v1/messages/count_tokens endpoint is free to use, limited to 5,000, 10,000 or 20,000 requests per minute depending on your usage tier, and its limits are separate from message creation. Anthropic notes the result is itself an estimate that can differ from billed input by a small amount.
Why does Claude Sonnet 5.5 use more tokens than Claude Sonnet 4.6 for the same text?
Claude Opus 4.7 and later models, including every Claude 5 and Fable model, use a newer tokenizer that Anthropic says produces approximately 30% more tokens for the same text; the exact increase depends on the content. Billing follows that model's own count, so recount prompts when you switch models instead of reusing old counts.
How much do 100,000 tokens cost on Claude Sonnet 5.5?
$0.20 as input and $1.00 as output at standard rates ($2.00 / $10.00 per 1M tokens, verified 2026-11-17). Prompt caching and the batch API lower this; see the calculator.
Does token counting use prompt caching?
No. Anthropic's token counting does not apply caching logic, even if you include cache_control blocks. Caching only happens when you create a message.
Is my text sent to Anthropic?
No. This page counts in your browser with an open-source tokenizer and sends nothing anywhere. Only the official API call shown above sends text to Anthropic.
Other token counters
- All models token counter (every provider, tokenizer methodology)
- Gemini token counter
- OpenAI token counter
Tokenizer: gpt-tokenizer 3.4.0 (MIT, license), served from this site.