MockFoxAdvertise

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.

Paste, type, or drop a file onto the box.
Claude tokens (estimate)
≈93
use count_tokens for exact
Characters
260
260 bytes UTF-8
Words
45
2.07 tokens / word
Lines
3
2.80 chars / token
OpenAI o200k_baseestimate
≈62
GPT-6, GPT-5.x, GPT-4.1, GPT-4o, o3, o4-mini
Claude (new tokenizer)estimate
≈93
Fable, Opus 4.7+, Sonnet 5+, Haiku 5.5
Claude (previous)estimate
≈72
Sonnet 4.6, Haiku 4.5 and older

Tokens, context window and input cost by model

ModelTokensContext usedInput 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

  1. Paste your prompt or document. The headline is the estimate for current Claude models (Opus 4.7+, Sonnet 5+, Haiku 5.5, Fable).
  2. Check the table for each Claude model's context usage and input cost.
  3. 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

ModelInputCached inputOutputContext
Claude Fable 5.1
claude-fable-5-1
$10$0.25$501M
Claude Opus 5.5
claude-opus-5-5
$4$0.20$201M
Claude Opus 5
claude-opus-5
$5$0.50$251M
Claude Opus 4.8
claude-opus-4-8
$5$0.50$251M
Claude Sonnet 5.5
claude-sonnet-5-5
$2$0.10$101M
Claude Sonnet 5
claude-sonnet-5
$2$0.20$101M
Claude Sonnet 4.6
claude-sonnet-4-6
$3$0.30$151M
Claude Haiku 5.5
claude-haiku-5-5
$0.10$0.01$0.501M
Claude Haiku 4.5
claude-haiku-4-5
$1$0.10$5200K

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