# Context Cost

> See how many tokens your codebase is, price that context window, and check CLAUDE.md and .cursorrules size. An o200k_base estimate, not a bill.

- URL: https://bytescope.dev/en/context-cost/
- Locale: en · Also: [ja](https://bytescope.dev/ja/context-cost.md) · [zh-Hant](https://bytescope.dev/zh-Hant/context-cost.md)
- Runs: The repo stays in this tab. The anonymous event is the tool id, whether a rules file was found, and success or failure. No path, token count, or amount.
- Requires: Chrome, Edge or Opera on desktop can pick the folder (File System Access). Firefox and Safari pick it through a file input. Counting stays in the tab either way.
- Updated: 2026-09-08

## What it does

Point this page at a repo when the question is how many tokens is my codebase, what it costs to put that tree in a context window, and whether the rules files point at something missing or say the same sentence three times. The walk, the count and the prices stay in this tab.

### An estimate, not a bill

The count uses OpenAI's `o200k_base` tokenizer, loaded with `await import()` the first time a scan runs. It matches OpenAI models. Claude and Gemini tokenize differently, and the same text is usually 10–30% more tokens there. A claude md token count here is that estimate, not Claude's tokenizer, and it is not an invoice.

### The root .gitignore only

Filtering reads the `.gitignore` at the root of the repo: comments that start with `#`, blank lines, `!` negations, directory rules that end in `/`, and globs with `*`, `**` and `?`. A `.gitignore` inside a subfolder is not read. `.git/` and `node_modules/` are always skipped, and a negation cannot bring them back. This version does not look for rules that contradict each other. There is no control for that, because it is not implemented.

### The per-turn price is the rules file

The rules check prices the text that is loaded on every turn. Output is 0, because a rules file is read in and nothing is written back. That figure is not the cost of the whole conversation, and it is separate from the context window cost calculator total for the rest of the tree. The cache-hit rate starts high because a system prompt is sent again every turn and usually hits. `.cursorrules` size is part of that rules total when the file is there.

### What stays in this tab

Nothing is uploaded. The anonymous event carries the tool id, whether a rules file was found, and whether the scan succeeded. The screen shows paths, and it shows the line of a dead reference or a repeated sentence, because the line is the finding. Those words stay in this tab. The page never edits a file. A browser without the folder picker still gets this page, including the text below: use the file input.

## Limits

Does not upload the repo, does not edit any file, does not read a .gitignore outside the repo root, and does not detect rules that contradict each other. Token counts are an o200k_base estimate, not a bill.

## FAQ

### Is the repo uploaded to count tokens?

No. The walk and the tokenizer run in this tab, in a worker, one file at a time. The anonymous event is the tool id, whether a rules file was found, and success or failure. It does not include a path, a token count, or an amount.

### Why does this disagree with Claude's token count?

This page counts with `o200k_base`, which is the OpenAI tokenizer. Claude and Gemini use different ones. The same text is usually 10–30% more tokens on those. Treat the number as an estimate. Do not pay a bill from it.

### Does a .gitignore in a subfolder apply?

No. Only the `.gitignore` at the root is read. Comments, blank lines, `!` negations, directory rules and `*` / `**` / `?` globs in that file are honored. A nested `.gitignore` is ignored in this version, and the page says so. `.git/` and `node_modules/` are skipped even if a rule names them.

### Will this find rules that contradict each other?

No. Contradiction detection is not in this version, and there is no button for it. The check is mechanical: what the rules files cost to load each turn, which backtick paths and script names are missing, and which sentence appears at least three times.

### What does the per-turn price include?

Only the rules files, loaded again each turn. Output is 0 because those files are read in and nothing is written back. It is not the price of the rest of the conversation, and it is not the price of stuffing the whole tree into one prompt. That second number is listed separately, as input only, also with no reply.

### Which browsers can pick the folder?

Chrome, Edge and Opera on desktop can use the folder picker and can remember it. Firefox and Safari use the file input. The count stays in the tab either way, and this text is on the page for every browser. A text file over 8 MiB is sized and marked tokens-not-counted.

## Related tools

- [Agent Cost](https://bytescope.dev/en/agent-cost.md) — Add up Claude Code and Codex cost from logs already on disk.
- [LLM Pricing](https://bytescope.dev/en/llm-pricing.md) — Published per-million rates, with the day each card was checked.
