Free online tool

Claude Token Counter

Paste any text and instantly estimate the token count for Claude API usage planning. Check context window usage and estimated cost for every Claude model.

Real-time token estimation as you type.
Context window usage visualization per model.
Estimated API cost based on current pricing.

Estimation based on Claude's BPE tokenizer ratios. Actual count may vary ±5–10%.

Estimated tokens

0

0 chars0 words0 sentences
Context window usage0.0%

0 / 1,000,000 tokens

Estimated input cost

<$0.001

Based on Claude Opus 4.7 pricing ($5/M input tokens)

How it works

How Does the Claude Tokenizer Work?

Claude models use a Byte Pair Encoding (BPE)tokenizer that breaks text into subword units called tokens. Common words like "the" or "code" are single tokens; less common or longer words are split into multiple tokens.

For English text, one token is roughly 3.5 characters or about ¾ of a word. For CJK languages (Chinese, Japanese, Korean), the ratio is closer to 1 token per 1.5 characters because each character carries more semantic weight.

Anthropic does not publish the exact tokenizer vocabulary for Claude 3 and newer models. The official @anthropic-ai/tokenizernpm package states it is "no longer accurate" for Claude 3+. For exact counts, use the Anthropic API's count_tokens endpoint.

Reference

Claude Model Context Limits and Pricing

The latest Claude models support up to 1M token context windows. Pricing varies significantly by model — choose the right one for your use case.

ModelContextInput / 1MOutput / 1M
Claude Opus 4.7Latest1,000,000$5.00$25.00
Claude Sonnet 4.6Latest1,000,000$3.00$15.00
Claude Haiku 4.5Latest200,000$1.00$5.00
Claude Opus 4.61,000,000$5.00$25.00
Claude Sonnet 4.5200,000$3.00$15.00
Claude Opus 4.5200,000$5.00$25.00
Claude Opus 4.1200,000$15.00$75.00
Claude Sonnet 4Deprecated200,000$3.00$15.00
Claude Opus 4Deprecated200,000$15.00$75.00

Pricing shown in USD. Last updated May 2026. Check the Anthropic documentation for the latest rates.

FAQ

Frequently Asked Questions

How accurate is this Claude token counter?

This tool estimates token counts based on Claude's BPE tokenizer ratios. For English text, the estimate is typically within ±5–10% of the actual count. For code or mixed-language content, the variance may be slightly higher. If you need an exact count, use the Anthropic API's count_tokens endpoint or check the usage field in API responses.

How many characters is one Claude token?

For English and most Latin-script text, one Claude token is approximately 3.5 characters — roughly 0.75 words. For CJK languages (Chinese, Japanese, Korean), the ratio is closer to 1 token per 1.5 characters because each character carries more information.

What is the context window for Claude models?

Claude models have different context windows. Claude Opus 4.7 and Claude Sonnet 4.6 support up to 1,000,000 (1M) tokens. Claude Haiku 4.5 and older models (Opus 4.6, Sonnet 4.5, Opus 4.5, Opus 4.1, Sonnet 4, Opus 4) support 200,000 tokens. This limit covers the combined total of input and output tokens in a single request.

How much does the Claude API cost per token?

Pricing depends on the model you choose. Claude Sonnet 4.6 costs $3/M input and $15/M output tokens. Claude Opus 4.7 is $5/M input and $25/M output. Claude Haiku 4.5 is the most affordable at $1/M input and $5/M output. Legacy models like Claude Opus 4 and Opus 4.1 cost $15/M input and $75/M output.

Does Anthropic provide an official tokenizer?

Anthropic published the @anthropic-ai/tokenizer package on npm, but the package README states it is "no longer accurate" for Claude 3 and newer models. There is currently no public, accurate browser-side tokenizer for modern Claude models. The count_tokens API endpoint remains the most reliable option for exact counts.

Why do token counts matter for Claude API usage?

Token counts directly affect your API costs and whether your request fits within the model's context window. If your prompt exceeds the context limit (200K or 1M tokens depending on model), the API will return an error. Estimating token counts before sending requests helps you plan costs and avoid failed calls.

Related tool

Claude Code Usage Calculator

Estimate your weekly Claude Code or Codex usage pressure and decide which plan is more likely to fit your workflow.

Open Calculator

Learn more

Claude Code Limit Explained

Understand what Claude Code limit pressure means, when to trust it, and how to plan around it before it affects your workflow.

Read Guide