Claude Opus 4.6 Token Counter

Exact token count and cost for Claude Opus 4.6, worked out in your browser.

0 characters0 words
Tokens~97% accurate
0
Estimated cost
Input
$0.00
$5/1M tokens
Output
$0.00
$25/1M tokens
Context window0 / 200,000
0.00% used

How this count is produced

This runs Anthropic's real tokeniser locally in the page. It is not a heuristic and not characters divided by four, it is the same byte-pair vocabulary the API uses, so for plain text and code the number here matches what you will be billed for.

That is not true of every model on this site. Most of them have no published local tokeniser and are counted with a stand-in encoding, which makes them estimates. Claude is one of the ones that can be counted exactly.

What the number leaves out

  • Your system prompt, unless you paste it in too. It is billed as input on every single turn.
  • Tool definitions. A dozen tools with detailed JSON schemas can be several thousand input tokens on every request, and this is the one that surprises people.
  • Message framing, a small fixed overhead per turn.
  • Images, which Opus charges for on their own rules. This page counts text only.
  • Prompt caching. If you use cache reads, your real input cost is far below what is shown here.

More detail

What it costs

Opus 4.6 is $5 per million input tokens and $25 per million output. The 5 to 1 ratio is the thing to plan around: for chat and agent workloads the bill is driven by how much the model writes, not how much you send.

A 30,000-token input costs 15 cents. The 4,000-token answer to it costs 10 cents. Ten thousand of those conversations is $2,500, and most of the way there was output.

The consequence is that trimming your prompt is usually the wrong optimisation. Capping the maximum output length, asking for structured data instead of prose, and not letting the model restate your input back to you all save considerably more.

The 200K window in practice

200,000 tokens is roughly 150,000 words, or a 500-page book. In real use you hit the cost ceiling long before the context ceiling: filling the window once costs a dollar in input alone, and you pay it again every turn unless you are caching.

When Opus is the wrong pick

For classification, extraction, formatting and routing, Sonnet 4.6 does the job at $3 and $15 and the quality gap on that kind of work is small. Opus earns its price on long multi-step reasoning and hard code. Count your prompt on both pages and compare before committing.

Questions

Does this send my text to Anthropic?

No. The tokeniser vocabulary is bundled into the page and the encoding runs in your browser. Turn off your network connection and it still works.

Why does my API response report a different input count?

Almost always the system prompt or the tool definitions, neither of which is in the text you pasted. Compare a real response's reported usage against this page for the same message body; the difference is your fixed per-request overhead and it is constant.

Is Opus tokenised differently from Sonnet or Haiku?

No. Counts are identical across the Claude family for the same text. Only the price differs, which is why changing the model in the dropdown changes the cost but not the token count.

How does code tokenise compared to prose?

Expect 300 to 450 tokens for a 60-line TypeScript file, against roughly 1.3 tokens per word for English prose. Code fragments into more, smaller tokens because of punctuation and indentation.

Related tools