Tool

CLAUDE.md Token Budget Checker

Paste a CLAUDE.md, AGENTS.md or rules file to count its characters, lines, words and approximate tokens, see what it adds up to across sessions and subagents, and find lines worth trimming. The checks follow CLAUDE.md vs AGENTS.md: context architecture and token budgets. The text stays in this page: nothing is uploaded, sent over the network or saved in your browser.

Paste one file, or several files one after another to size the whole always-loaded stack.

Size of this file

Characters
0
0 UTF-8 bytes
Lines
0
Target under 200
Words
0
Approximate tokens
0
About 4 characters per token

The token figure is an approximation at about 4 characters per token, the planning heuristic the article's worked example uses. For a count from the model's own tokenizer (Anthropic still calls it an estimate), send the text to the Claude token counting API or run /context all in Claude Code.

No text pasted.

Approximate tokens across sessions and subagents

An always-loaded file is paid once per context window that loads it. Every non-fork subagent starts with the same CLAUDE.md hierarchy as the main session, so a session that spawns N of them loads the file 1 + N times. Read how subagents inherit instruction files.

Approximate instruction tokens loaded across all context windows. Billing also depends on prompt caching and model rates.
NN separate sessionsMain session plus N non-fork subagents
100
500
1500

The built-in Explore, Plan and web-fetch agents skip CLAUDE.md, a custom agent can opt out with omitClaudeMd: true, and a fork inherits the parent conversation instead. The article's worked example uses the same arithmetic: 20,000 characters is about 5,000 tokens, and 80,000 with 15 subagents.

What to trim

Paste a file above to see findings.

What the checks are based on

  • Long file. The Claude Code memory docs target under 200 lines per CLAUDE.md file and warn that longer files reduce adherence, as the CLAUDE.md and AGENTS.md comparison records.
  • 40,000 characters. On-demand files have a per-file limit of 40,000 characters on a 200K context window; past it, Claude receives only the start of the file.
  • 32 KiB. Codex stops adding AGENTS.md files once the combined chain reaches 32 KiB by default, which matters when this file is an AGENTS.md shared with Codex.
  • Path-specific sections. Files in .claude/rules/ can carry a paths glob so they load only when Claude touches a matching file, which is where the docs place guidance for one part of the codebase. After compaction, the project-root CLAUDE.md and unscoped rules are re-injected, while path-scoped rules reload only on demand, so invariants belong in the root file. See what survives compaction.
  • Imports and comments. @path imports load with the file that imports them, so they do not reduce cost, and block-level HTML comments are stripped before injection.
  • Repeated lines and empty headings are plain text checks: each copy and each empty heading is loaded every time the file is.

To measure what actually loaded, run /context all and read its Memory files list, as Context Engineering for Long-Horizon Agents explains. The MCP vs CLI token cost calculator prices the tool definitions that share the same startup prefix, and the Claude Code architecture cheatsheet collects the related commands and settings.