---
title: "Token cost calculator for your files"
description: "Free token cost calculator: drop files or a folder, see token counts, what each model charges per question, and what caching or memory changes. No signup, files stay in your browser."
canonical: https://past.dev/tools/token-cost-calculator
last-updated: 2026-09-02
---
# Token cost calculator for your files

Source: https://past.dev/tools/token-cost-calculator

This token cost calculator reads files in your browser, estimates tokens for current Claude, GPT, and Gemini models, and prices three ways of using that corpus: resending it with every question, serving it from the provider's prompt cache, and recalling only relevant evidence from a memory layer. Nothing is uploaded, and no signup is required.

## How the estimate works

Files are read locally and never leave the browser. Characters are converted to tokens with a per-model ratio. For Claude models on the current tokenizer, Anthropic's [models overview](https://platform.claude.com/docs/en/models/overview) states that 1M tokens is roughly 2.5M Unicode characters, which gives 2.5 characters per token. For GPT and Gemini models the page uses 4.0 characters per token, the common English-text approximation. Code counts as denser than prose by a factor of 0.85.

The result is an estimate for planning. Billing-exact counts come from the vendors' own counters: Anthropic's [token counting endpoint](https://platform.claude.com/docs/en/build-with-claude/token-counting) and the tokenizer pages OpenAI and Google publish.

## Prices used by the calculator

Prices were read from each vendor's published pricing on 2026-09-02 and are USD per million tokens. Cached input is the price of a prompt-cache read. Anthropic bills 5-minute cache writes at 1.25x input; Google also bills cached storage by the hour, which this page does not model.

| Model | Input | Cached input | Output | Context |
| --- | --- | --- | --- | --- |
| Claude Fable 5.1 | $10 | $0.25 | $50 | 1M |
| Claude Opus 5 | $5 | $0.5 | $25 | 1M |
| Claude Sonnet 5 | $2 | $0.2 | $10 | 1M |
| Claude Haiku 4.5 | $1 | $0.1 | $5 | 200K |
| GPT-5.6 Sol | $4 | $0.4 | $20 | 1.05M |
| GPT-5.6 Terra | $2 | $0.2 | $12 | 1.05M |
| GPT-5.6 Luna | $0.2 | $0.02 | $1.2 | 1.05M |
| Gemini 3.7 Flash | $0.75 | $0.075 | $3.75 | 1.05M |

Sources: [Anthropic pricing](https://platform.claude.com/docs/en/about-claude/pricing), [OpenAI pricing](https://developers.openai.com/api/docs/pricing), [Gemini pricing](https://ai.google.dev/gemini-api/docs/pricing).

## The three scenarios, defined

- **Resend.** The whole corpus rides along as input on every question: 30 days of questions, each carrying the corpus plus a 200-token question and a 500-token answer.
- **Prompt cache.** The corpus is written to the provider's cache once per day and read on later questions at the cached-input price. Real cache hits depend on TTLs and request spacing, so this column is the best case for caching.
- **Memory.** The corpus is ingested once into a memory layer. Each question sends only itself plus a recalled evidence slice of 1,500 tokens. The memory layer's own fee is separate: see [pricing](/pricing) for what past.dev charges.

The multiple the tool reports is resend divided by memory, computed from your files and your question volume. Recall in past.dev returns ranked, dated evidence with a `status` value, so the model reads a small slice instead of the whole history. The [quickstart](/docs/memory-api/quickstart) shows the two calls involved.

## What fits in a context window

The tool also checks your corpus against each model's context window and reports the headroom left after one question and answer. A corpus that fits today still pays its full token price on every request, and retrieval quality degrades as windows fill. [What is agent memory?](/what-is-agent-memory) covers when a window is the right tool and when a memory layer is.

## Limits of this tool

- Token counts are character-ratio estimates. Tokenizers differ by language and content; expect deviation around 10 percent, larger for non-English text.
- Only text-like files are read (code, Markdown, CSV, JSON, HTML, logs). Binary formats and PDFs are skipped and listed as skipped.
- Prices change. Each price carries its source and the date it was checked, printed above.
- The caching column models one write per day; workloads with sparse or bursty questions will see worse cache economics than shown.

## Frequently asked questions

### Do my files get uploaded?

No. The page reads files with the browser's File API, counts characters locally, and computes costs locally. Nothing is sent to a server, and the page works the same offline once loaded.

### How accurate is the token count?

It is an estimate from characters per token: 2.5 for current Claude models (a vendor-published figure), 3.4 for Claude Haiku 4.5, and 4.0 for GPT and Gemini models. Expect deviation around 10 percent. For billing-exact numbers use the vendor token counters linked on this page.

### Which prices does the calculator use?

Vendor list prices read on 2026-09-02 from Anthropic, OpenAI, and Google pricing pages, in USD per million tokens, including cached-input prices. Each row's source URL is in the dataset, and the date is printed with the table.

### How does memory reduce token costs?

A memory layer ingests the corpus once, then answers each question from a small recalled slice with dates and sources instead of resending the whole history. Input tokens per question drop from corpus size to slice size; the tool computes the resulting multiple from your own files.

### Is this calculator free?

Yes. No signup, no account, no usage limit. It exists because past.dev sells the memory layer in the third scenario, and the arithmetic is more convincing than the pitch.

## Related

- [Memory API quickstart](https://past.dev/docs/memory-api/quickstart)
- [What is agent memory?](https://past.dev/what-is-agent-memory)
- [Context engineering](https://past.dev/context-engineering)
- [How past.dev measures recall](https://past.dev/benchmarks)
- [past.dev pricing](https://past.dev/pricing)