Claude Token Counter & Prompt Cache Calculator

Count Claude Opus, Sonnet, and Haiku tokens locally and compare standard API spend against 5-minute prompt caching, 1-hour caching, and the 50% Batch API discount

Free, no signup — your prompts and CLAUDE.md stay in this browser.

Claude Token Counter

~440 input tokensSonnet 5.55m cache saves 0%21 calls

System Context + User Turn
~361 tokens+151 tok to hit 512 cache min
~79 tokens35 words
Total Input Tokens
440
361 cached prefix + 79 user
5-Min Cache Total
$0.270
Saves $0.00 (0%)
Batch API (50% off)
$0.135
Saves $0.135 (50%)

Editable Sonnet 5.5 rates ($/MTok)

5-min write: $2.500/MTok (1.25×) · 1-hr write: $4.000/MTok (2×) · Cache read: $0.100/MTok (0.05×)

Context window (1M)

440 / 1,000,000 tokens0.04% used
Offline Claude BPE estimate — verify exact billable counts with Anthropic count_tokens APISaved in this browser

Claude Sonnet 5.5 — Session Cost Breakdown (21 calls: 1 write + 20 hits)

Compares Standard Messages API, 5-minute & 1-hour Prompt Caching, and the 50% Batch API discount.

Billing ModeCache MultipliersSession Total (21 calls)Effective / CallSavings vs Standard
Standard API (No Cache)Full input price on every call1.0× input$0.270$0.013Baseline
5-Minute Prompt CachingPrefix under the 512-token minimum is not cached1.25× write / 0.05× read$0.270$0.013Save $0.00 (0%)
1-Hour Prompt CachingPrefix under the 512-token minimum is not cached2× write / 0.05× read$0.270$0.013Save $0.00 (0%)
Batch API (Standard)Async 24h queue · flat 50% off input & output0.5× total$0.135$0.0064Save $0.135 (50%)
Batch API + 5-Min CacheStacking Batch 50% discount with prompt cache hits0.5× (1.25×w / 0.05×r)$0.135$0.0064Save $0.135 (50%)

Compare All Claude Models (21 calls)

Click a row to switch active model.

Claude ModelIn / Out ($/MTok)Standard5-Min Cache1-Hr CacheBatch API (50%)
Claude Fable 5.2Most capable model · cache hits 0.025×$8 / $40$1.082$1.082$1.082$0.541
Claude Opus 5.5Flagship reasoning & coding · cache hits 0.05×$4 / $20$0.541$0.541$0.541$0.270
Claude Sonnet 5.5Balanced speed & intelligence · cache hits 0.05×$2 / $10$0.270$0.270$0.270$0.135
Claude Haiku 5.5Lowest cost · $0.50 / $2.50 for prompts over 100K tokens$0.1 / $0.5$0.014$0.014$0.014$0.0068
Claude Opus 4.8Previous-generation Opus$5 / $25$0.676$0.676$0.676$0.338
Claude Sonnet 4.6Previous-generation Sonnet (older tokenizer)$3 / $15$0.406$0.406$0.406$0.203
Claude Haiku 4.5Previous-generation Haiku · 4,096-token cache minimum$1 / $5$0.135$0.135$0.135$0.068
Counted locally in your browser · 0 bytes uploaded~361 cached + ~79 user5m cache: $0.270Batch: $0.135Guide & FAQ

How Anthropic prompt caching cuts API bills

Most Claude agent loops, RAG pipelines, and coding assistants resend the same large prefix on every turn: system instructions, CLAUDE.md project rules, tool JSON schemas, and reference files. With prompt caching, you write that prefix once and reuse it at 90% to 97.5% off on every cache hit, depending on the model.

  • 5-minute cache (1.25× write): The TTL refreshes on every hit. Ideal for interactive chats, multi-step tool use, and Claude Code sessions where turns arrive within minutes of each other.
  • 1-hour cache (2× write): Pays a slightly higher write premium in exchange for keeping the cache warm across slower user bursts or background evaluation queues.
  • Cache hits (0.1× on most models): 0.05× on Claude Opus 5.5 and Sonnet 5.5, and 0.025× on Claude Fable 5.1 and 5.2. Each hit also refreshes the entry's TTL at no extra cost.
  • Batch API (50% flat discount): Halves both input and output rates for workloads that can wait up to 24 hours — and stacks with prompt caching when batched prompts share a prefix.

Claude model tiers & reference rates

Anthropic list prices as of November 2026 (platform.claude.com pricing). Every $/MTok rate in the calculator above is editable, so you can model negotiated rates or data-residency pricing.

ModelInput / OutputCache HitMin Cache PrefixContext WindowNotes
Claude Fable 5.2$8 / $40 per MTok0.025× input512 tokens1MMost capable model · cache hits 0.025×
Claude Opus 5.5$4 / $20 per MTok0.05× input512 tokens1MFlagship reasoning & coding · cache hits 0.05×
Claude Sonnet 5.5$2 / $10 per MTok0.05× input512 tokens1MBalanced speed & intelligence · cache hits 0.05×
Claude Haiku 5.5$0.1 / $0.5 per MTok0.1× input512 tokens1MLowest cost · $0.50 / $2.50 for prompts over 100K tokens
Claude Opus 4.8$5 / $25 per MTok0.1× input1,024 tokens1MPrevious-generation Opus
Claude Sonnet 4.6$3 / $15 per MTok0.1× input1,024 tokens1MPrevious-generation Sonnet (older tokenizer)
Claude Haiku 4.5$1 / $5 per MTok0.1× input4,096 tokens200KPrevious-generation Haiku · 4,096-token cache minimum

Minimum cacheable prefix by model

A prefix shorter than the minimum is processed without caching and returns no error; check that cache_creation_input_tokens is above 0 on the first call.

MinimumModels
512 tokensFable 5.2 / 5.1 / 5, Mythos 5.x, Opus 5.5, Opus 5, Sonnet 5.5, Haiku 5.5
1,024 tokensOpus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4
2,048 tokensOpus 4.7, Mythos Preview
4,096 tokensOpus 4.6, Opus 4.5, Haiku 4.5

Built for Claude developers

Writing project instructions for Claude Code? Draft a lean instruction file with our CLAUDE.md & AGENTS.md Generator, then paste it into the System Prompt box above to verify how much of your context budget it consumes on every session.

Need to share a formatted Claude response or artifact with teammates? Export it cleanly with Claude to PDF, or compare Claude costs against OpenAI GPT-5, Gemini 2.5, and Llama 4 in our multi-model LLM Token Counter.

Frequently Asked Questions

How do Anthropic’s 5-minute and 1-hour prompt caching multipliers work?

When you tag a static prefix with cache_control, the first call pays a cache write surcharge: 1.25× the base input price for a 5-minute TTL, or 2× for a 1-hour TTL. Every later call that hits the warm prefix pays a fraction of the input price for those tokens: 0.1× on most models, 0.05× on Claude Opus 5.5 and Sonnet 5.5, and 0.025× on Claude Fable 5.1 and 5.2. A 5-minute cache pays for itself after one hit; a 1-hour cache after two.

What is the minimum token count required for Claude prompt caching?

It depends on the model: 512 tokens on Claude Fable 5.x, Opus 5.5, Opus 5, Sonnet 5.5 and Haiku 5.5; 1,024 on Opus 4.8, Sonnet 5 and Sonnet 4.6; 2,048 on Opus 4.7; and 4,096 on Opus 4.6, Opus 4.5 and Haiku 4.5. A shorter prefix is silently processed without caching (no error, cache_creation_input_tokens is 0), so this tool flags it beside your System Prompt box and prices it at the standard rate.

Can you combine Anthropic’s Batch API 50% discount with prompt caching?

Yes. Message Batches cut input and output rates by 50%, and Anthropic’s caching multipliers stack with that discount, so requests in a batch that share an identical cached prefix cost less again. The breakdown table shows both Batch-only and Batch + 5-min cache totals.

Is my system prompt or CLAUDE.md sent to Anthropic or MarkdownTools?

No. Token counts and cost projections are computed 100% locally in your browser using an offline Claude-tuned BPE estimator. Nothing is transmitted over the network. For exact billable token counts before sending a production batch, use Anthropic’s free /v1/messages/count_tokens API endpoint.

Does Claude charge more for long prompts?

Claude 4.6 and later models (except Haiku 5.5) include the full 1M-token context window at standard per-token prices. Claude Haiku 5.5 is the exception: a request whose prompt is over 100,000 tokens, cache reads and writes included, pays $0.50 / $2.50 per MTok instead of $0.10 / $0.50, and the calculator switches to those rates automatically. Claude Haiku 4.5 has a 200K window.