Code Cost Calculator
Claude Code Cost Calculator
Estimate Claude Code API cost in dollars from input tokens, output tokens, and cache tokens. Paste the counts, or open a local JSONL usage log in your browser. No API key, and no request leaves this page.
Claude Code token cost
Claude Code bills like the Claude API: uncached input, output, 5-minute cache writes, 1-hour cache writes, and cache reads. Cache reads are the cheap part. On Sonnet 5.5 they are $0.10 per million tokens, not the $2 input rate. The Claude Code token cost page walks through that split. A log that only reports input_tokens is missing almost the whole prompt.
Prices on this page were checked . They are approximate public list rates. The pricing table is generated from the same file the calculator uses.
Tokens to dollars
Dollars equal tokens divided by one million, times the rate for that token type. A heavy Claude Code day is usually a small uncached tail, a large cache read, a cache write, and the output. The worked example below is the same workload loaded in the calculator.
| Token type | Tokens | Rate | Cost |
|---|---|---|---|
| Uncached input | 85,000 | $2.00 / MTok | $0.17 |
| Cache reads | 18,000,000 | $0.10 / MTok | $1.80 |
| 1-hour cache writes | 1,200,000 | $4.00 / MTok | $4.80 |
| Output | 220,000 | $10.00 / MTok | $2.20 |
$8.97 of API-equivalent usage is under the $20 Claude Pro sticker and far under Max and Ultra. That comparison is not a remaining balance. Anthropic does not publish Pro, Max, or Ultra as a token quota.
Claude Pro, Max, and Ultra versus API cost
Pro is $20 a month, or $200 billed yearly. Max is $100 and is described as 5× Pro usage every five hours and every week. Ultra is $200, with 10× Pro weekly usage and no five-hour limit on verified accounts. Claude Code shares those limits with chat.
Max and Ultra also include API credits. Anthropic says those credits cannot be used in Claude Code or the Claude apps, so this calculator does not subtract them. If you hit a limit, the API-equivalent total can still be lower than the sticker.
How to estimate cost from Claude Code usage
Session logs live under ~/.claude/projects/, one JSONL file per session. Drag the file onto the calculator. The parser keeps one row per API call: streamed lines that share a message id and request id collapse to the largest output count. Cache writes use the 5-minute and 1-hour split when the log has it.
Frequently asked questions
How does this Claude Code cost calculator work?
It multiplies your token counts by the public per-million-token rates stored in this site. Uncached input, output, cache reads, and cache writes each have their own rate. The result is an API-equivalent dollar estimate. The math runs in your browser and nothing is sent to a server.
Why are Claude Code input tokens so small?
In Claude's usage object, input_tokens is only the tail after the last cache breakpoint. The large prompt usually sits in cache_read_input_tokens and cache_creation_input_tokens. This calculator prices those fields separately. Treating cache reads as full-price input would overstate the cost.
Is Claude Pro, Max, or Ultra cheaper than the API?
The page compares API-equivalent cost with the monthly sticker. Those plans include Claude Code, but Anthropic does not publish a token quota. A five-hour or weekly limit can stop you before the API-equivalent cost reaches the sticker. Max and Ultra also include API credits that Anthropic says cannot be used in Claude Code. Those credits are not subtracted.
Are these the official prices?
They are copied from public pricing pages and labeled with the date they were checked. Vendors change prices. Your contract, region, batch discount, or data-residency choice can differ. Confirm the source pages linked in the footer before you rely on a number.