Checked against Claude Code docs September 23, 2026

How to use fewer tokens in Claude Code

Whether you're on a plan that pauses you or an API key that bills you, the meter is the same: tokens, and tokens are context. Here are the changes that move it most, ranked by how much they save, each with the command or setting that does it.

Advertisement

First, understand where the tokens go

Claude Code sends your entire conversation with every request. When Claude uses a tool, that's another request carrying the tool result. Prompt caching means the unchanged prefix is re-read at a tenth of the price, but a session that's been open all day still drags the day behind every one-line question. Anthropic's costs page names the usual culprits for surprising bills: long sessions that were never cleared and Opus left as the default. Run /usage and look at the behavior flags; if "long context" or "cache misses" appear, that's 10% or more of your recent usage and the first thing to fix. /context shows what's occupying the window right now.

The twelve, in order of impact

#Do thisCommand / where
1Clear between unrelated tasks/rename then /clear; /resume later
2Sonnet by default, Opus on purpose/model, default in /config
3Lower thinking effort on simple work/effort or in /model
4Keep CLAUDE.md under 200 linesMove workflows into skills
5Disable MCP servers you aren't using/mcp
6Send noisy work to subagentsTests, logs, docs fetches
7Filter output with hooksPreToolUse hook on Bash
8Compact with instructions, not blindly/compact Focus on …
9Plan mode before big changesShift+Tab to plan mode
10Write specific promptsName the file and function
11Stop early, rewindEsc, /rewind
12Watch idle usageLoops, teammates, check-ins

1. Clear between tasks

This is the big one. Stale context costs tokens on every subsequent message, forever, until you clear. Anthropic's recommended rhythm: /rename the session so you can find it, /clear, and /resume when you come back to that work. /clear costs nothing; it just starts a new session. If you have a bloated session you want to keep, /compact replaces the history with a summary, but note that compacting is itself a large request because Claude reads everything to summarize it.

2. Model choice

Sonnet handles most coding. Opus costs about 2.5× per token and, on Max plans, has its own smaller weekly allowance on top of the shared cap. Fable is about 5×. Switching to Opus also applies to subagents that inherit your model, so set model: haiku on simple subagents in their configuration. Reserve Opus for architecture, tricky debugging and multi-step planning, and switch back.

3. Effort and extended thinking

Extended thinking is on by default because it helps on hard problems, and thinking tokens bill as output. For routine edits, lower the effort level with /effort or in /model. On models with a fixed thinking budget you can also set MAX_THINKING_TOKENS=8000; adaptive-reasoning models ignore that and use effort levels instead. Opus 5.5 and the Fable models can't turn thinking off.

4. Trim CLAUDE.md, move instructions to skills

CLAUDE.md loads into context at the start of every session, so detailed instructions for PR reviews or database migrations are paid for even when you're doing unrelated work. Skills load on demand only when invoked. Anthropic's guidance: keep CLAUDE.md under 200 lines, essentials only, and put specialized workflows in skills. A "codebase-overview" skill that describes your architecture also saves Claude from exploring files to learn it.

5. MCP servers

Tool definitions are deferred by default (only names and server instructions enter context until a tool is used), but every configured server still adds something. Run /mcp and disable what you're not using this week. CLI tools like gh, aws and gcloud are more context-efficient than their MCP equivalents because they add no tool listing at all.

6. Subagents for verbose work

Running a test suite, reading a log, fetching documentation: the output lands in your main context and stays there. Delegate those to a subagent and only the summary comes back. This is the difference between a 30,000-token test run in your window and a two-line result.

7. Hooks that filter before Claude sees it

A PreToolUse hook on Bash can rewrite npm test to pipe through grep -A 5 -E '(FAIL|ERROR)' | head -100, so Claude reads only the failures. Same idea for log files: a hook that returns matching lines turns tens of thousands of tokens into hundreds. Anthropic's costs page has a copy-paste example.

8. Compact with instructions

Blind compaction keeps the wrong things. /compact Focus on code samples and API usage tells Claude what to preserve. You can make that the default by adding a "Compact instructions" section to CLAUDE.md. Remember compaction reads the whole conversation, so it's a tool for continuity, not for saving tokens in the moment.

9–11. Plan, be specific, stop early

Plan mode (Shift+Tab) has Claude explore and propose before it edits, which prevents the most expensive failure: a long implementation in the wrong direction. Specific prompts ("add input validation to the login function in auth.ts") avoid the broad scan that "improve this codebase" triggers. And when Claude heads the wrong way, Esc stops it immediately; /rewind or double-Esc restores code and conversation to a checkpoint instead of paying to undo it in prose.

12. Idle usage

A session can spend tokens while you're away: scheduled tasks fire with your full context, agent teammates keep running until they exit, cross-session messages arrive as new turns, goal check-ins start turns on background work. If you're on a plan, this eats the weekly cap; on the API, it's a bill. Shut down teammates when they're done, set crossSessionInbound to hold if you don't want inbound messages delivered while idle, and check the Loops rows in /usage.

One more for API users: cache lifetime

Prompt cache lifetime is an hour on a subscription but five minutes by default on an API key or on usage credits. Step away for six minutes and your next message reprocesses the entire context at full input price. If you take breaks, either clear before them or choose the longer TTL yourself; on Pro and Max, Claude Code will offer to resume a large session from a summary after a long gap.

See how much a lighter session stretches my week →

Frequently asked questions

What's the single biggest token saver?

/clear between unrelated tasks. Stale context costs on every subsequent message.

Does /compact save tokens?

For the rest of the session, yes; the compaction itself is a large request. Use /clear when you don't need continuity.

Does Sonnet vs Opus matter?

About 2.5× per token, plus Opus has its own weekly allowance on Max. Sonnet for most work.

How do I see what's using my context?

/context for the current window, /usage for the breakdown by skills, subagents, MCP servers and loops.

Do MCP servers cost tokens if I don't use them?

A little: tool definitions are deferred but server names and instructions still load. Disable unused ones in /mcp.

Why did my usage climb overnight?

Scheduled tasks, agent teammates, cross-session messages or goal check-ins each send your full context while idle.

Sources