Claude Token Counter
Updated Free mock REST & WebSocket APIs
Paste text to estimate how many tokens it uses with Anthropic's Claude models, how much of the context window it fills and what it costs as input. Anthropic doesn't publish a browser tokenizer, so the count is a calibrated estimate — use the snippet below for the exact number.
Tokens, context window and input cost by model
| Model | Tokens | Context used | Input cost |
|---|---|---|---|
Claude Fable 5.1 Anthropic | ≈93 | <0.01% of 1M | $0.00093 |
Claude Opus 5.5 Anthropic | ≈93 | <0.01% of 1M | $0.00037 |
Claude Opus 5 Anthropic | ≈93 | <0.01% of 1M | $0.00047 |
Claude Opus 4.8 Anthropic | ≈93 | <0.01% of 1M | $0.00047 |
Claude Sonnet 5.5 Anthropic | ≈93 | <0.01% of 1M | $0.00019 |
Claude Sonnet 5 Anthropic | ≈93 | <0.01% of 1M | $0.00019 |
Claude Sonnet 4.6 Anthropic | ≈72 | <0.01% of 1M | $0.00022 |
Claude Haiku 5.5 Anthropic | ≈93 | <0.01% of 1M | $9.3e-6 |
Claude Haiku 4.5 Anthropic | ≈72 | 0.04% of 200K | $7.2e-5 |
Prices checked on 2026-10-18 from each provider's official pricing page (standard tier, USD per 1M tokens). Prices change often — verify before you budget.
OpenAI counts are exact (tiktoken o200k_base / cl100k_base). Claude, Gemini, Llama, Mistral, DeepSeek and Grok don't publish a browser tokenizer, so those are estimates calibrated against o200k — exact counts: Claude count_tokens API, Gemini countTokens.
🔒 Runs in your browser — your text is never uploaded or sent to any AI provider.
How to count Claude tokens
- Paste your prompt or document. The headline is the estimate for current Claude models (Opus 4.7+, Sonnet 5+, Haiku 5.5, Fable).
- Check the table for each Claude model's context usage and input cost.
- For the exact count, call Anthropic's free count_tokens endpoint with the code below.
Two Claude tokenizers
Claude Opus 4.7 and later — including Claude Fable 5.x, Opus 5.x, Sonnet 5.x and Haiku 5.5 — use a newer tokenizer that Anthropic says produces about 30% more tokens for the same text than the one used by Claude Sonnet 4.6, Haiku 4.5 and earlier. That's why the tool shows two Claude estimates. OpenAI's tiktoken undercounts Claude, so don't budget Claude with a GPT token count.
Exact count with the count_tokens API
The token counting endpoint is free and counts system prompts, tools, images and PDFs too. Pass the model you'll use, since counts are model-specific:
# Python
from anthropic import Anthropic
client = Anthropic()
resp = client.messages.count_tokens(
model="claude-opus-5-5",
messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(resp.input_tokens)
// TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const { input_tokens } = await client.messages.countTokens({
model: "claude-opus-5-5",
messages: [{ role: "user", content: "Hello, Claude" }],
});Claude prices and context windows
| Model | Input | Cached input | Output | Context |
|---|---|---|---|---|
Claude Fable 5.1claude-fable-5-1 | $10 | $0.25 | $50 | 1M |
Claude Opus 5.5claude-opus-5-5 | $4 | $0.20 | $20 | 1M |
Claude Opus 5claude-opus-5 | $5 | $0.50 | $25 | 1M |
Claude Opus 4.8claude-opus-4-8 | $5 | $0.50 | $25 | 1M |
Claude Sonnet 5.5claude-sonnet-5-5 | $2 | $0.10 | $10 | 1M |
Claude Sonnet 5claude-sonnet-5 | $2 | $0.20 | $10 | 1M |
Claude Sonnet 4.6claude-sonnet-4-6 | $3 | $0.30 | $15 | 1M |
Claude Haiku 5.5claude-haiku-5-5 | $0.10 | $0.01 | $0.50 | 1M |
Claude Haiku 4.5claude-haiku-4-5 | $1 | $0.10 | $5 | 200K |
USD per 1M tokens, standard tier, checked 2026-10-18. Source: Anthropic pricing.
Cache reads cost a fraction of the input price (0.025× on Fable 5.1, 0.05× on Opus 5.5 and Sonnet 5.5, 0.1× elsewhere); writing the cache costs 1.25× input for a 5-minute TTL. Claude Haiku 5.5 switches to $0.50 / $2.50 per 1M for prompts over 100,000 tokens.
Related tools
Frequently asked questions
Is my text sent to OpenAI, Anthropic or anyone else?
No. Everything runs in your browser: the tokenizer files are downloaded once and your text never leaves your device. Nothing is logged or stored.
How many characters is a Claude token?
Roughly 3.5 characters of English for the previous Claude tokenizer and about 2.8 for the newer one used since Claude Opus 4.7. Code and non-English text use more tokens per character.
Can I use tiktoken to count Claude tokens?
Only as a rough guide. tiktoken is OpenAI's tokenizer and undercounts Claude — by roughly 15% on typical English for older Claude models and by about a third for the newer tokenizer. Use count_tokens for real numbers.
What is Claude's context window?
1M tokens for current models (Fable, Opus 4.6+, Sonnet 4.6+, Haiku 5.5) at standard pricing, except that Haiku 5.5 bills prompts over 100K tokens at a higher rate. Claude Haiku 4.5 has 200K.
Is count_tokens free?
Yes. Anthropic doesn't charge for token counting, though it is rate-limited separately from message requests.
Your business here? Sponsor this tool from $16/week. See placements