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.
| Model | Tokenizer | Price / 1M input | Context window |
|---|
| Claude Opus | claude-v4 * | $5.00 | 1M |
| Claude Sonnet | claude-v4 * | $3.00 | 1M |
| Claude Haiku | claude-v4 * | $1.00 | 200K |
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.