Token Studio

Claude Token Counter

Estimate tokens and cost for Claude Opus, Sonnet, and Haiku. The tokenizer runs in your browser and your text never leaves it.

Runs entirely in your browser Nothing is uploaded
Loading tokenizer…
10.9 MB · one-time
Est. cost
 
Tokens / word
 
Chars / token
 
Characters
327
58 words
Context window
Input text
327characters
270no spaces
58words
4sentences
Token breakdown
Claude Opus · claude-v4
Loading Claude tokenizer · 10.9 MB
Compare models — same text 3 of 28 · click to inspect
Model Tokens Cost
Claude Opus
loading tokenizer…
—
Claude Sonnet
loading tokenizer…
—
Claude Haiku
loading tokenizer…
—

Counts come from each model's real tokenizer, running entirely in your browser. Cost and context-window figures are estimates for guidance and may vary by model version.

Counting tokens for Claude models

Anthropic does not publish a tokenizer for current Claude models, so this page gives a close approximation rather than an exact count. Opus, Sonnet, and Haiku load together and share the same estimate; what changes between them is the price and the context window. When you need the official number (a hard context limit, a billing check), Anthropic's API has a token counting endpoint that returns it without running the model.

Pricing and context windows

Anthropic's list prices per million input tokens, with the context window of each tier.

ModelTokenizerPrice / 1M inputContext window
Claude Opusclaude-v4 *$5.001M
Claude Sonnetclaude-v4 *$3.001M
Claude Haikuclaude-v4 *$1.00200K

Marked as an estimate: Anthropic does not publish the tokenizer for these models, so the count is a close approximation. Prices and context windows are curated metadata refreshed periodically from the providers and OpenRouter, so treat them as guidance rather than a quote. Token counts are always produced by the real tokenizer.

How Claude tokenization works

All three Claude tiers are treated as a single tokenizer family here. Anthropic exposes token counts through its API but not the vocabulary behind them, so this tool uses a community byte-level BPE vocabulary of about 151,000 entries as a stand-in. On English prose it lands close to Anthropic's own count; code, other languages, and unusual formatting widen the gap.

Because the three tiers share the estimate, the compare table shows one token count against three prices: the quickest way to see what a prompt would cost on each tier.

Frequently asked questions

Is there an official Claude tokenizer?

No. Anthropic has not published the vocabulary behind current Claude models. The count here is an approximation and the tool labels it as an estimate. For exact numbers, Anthropic's API provides a token counting endpoint that returns the official count for a request.

How accurate is this Claude token count?

Close on English prose, less so on code and non-English text. The stand-in vocabulary splits ordinary English much the way Anthropic's does, so planning figures hold up well. Treat it as guidance rather than a billing figure, and verify anything sitting near a context-window boundary.

Do Opus, Sonnet, and Haiku count tokens differently?

No. The same text is the same number of tokens on all three. Price and context window are what differ: Opus and Sonnet take up to 1M tokens, Haiku 200K. The compare table shows the shared count next to each tier's cost.

Does the count include the system prompt?

No, it counts only the text in the box. A real Claude request also carries your system prompt, any tool definitions, and the conversation so far, all billed as input. Count those separately and add them when you budget a call.