How to Save Tokens in Claude Code: 9 Methods That Actually Work

AI Takeaway
Hitting limits? Learn 9 proven ways to save tokens in Claude Code: /clear, /compact, model choice, MCP trimming and more. Reduce Claude token usage fast
Key points
- What Actually Uses Your Tokens?
- Measure First; See Where Tokens Go
- 9 Methods to Reduce Claude Token Usage
- Why Long Sessions Burn Through Limits
- Claude Usage Limit Tips; If You Already Hit the Wall
- Quick Cheat Sheet
You are halfway through a refactor. Claude Code is finally on the right track. Then the message appears: you have hit your session limit.
Most of the time, the problem is not that you asked for too much. It’s that every message carried a huge pile of old context. Once you understand that, saving tokens in Claude Code becomes much easier without slowing down.
This guide explains where tokens go and gives you 9 methods that Anthropic’s own documentation backs up. It’s written for developers, students, and site owners who use Claude Code and want to stay under their limits.
What Actually Uses Your Tokens?
A token is a small chunk of text that Claude reads or writes. The more text Claude has to process, the more tokens you spend.
Anthropic’s docs put it simply: token costs scale with context size. Claude Code sends your full conversation with every request, and each time Claude uses a tool, another request carries those results. So a short question in a session that has been open all day still draws on the whole conversation.
Claude Code already helps with two features: prompt caching, which reduces the cost of repeated content like system prompts, and auto compaction, which summarizes history as you approach the context limit. Your job is to keep the Claude Code context window lean so those features have less to carry.
Measure First; See Where Tokens Go
/usage shows token usage for your current session. On Pro, Max, Team, and Enterprise plans, it also shows a breakdown of what counts against your limits, with recommendations.
/context shows what is filling your context window, including each MCP server.
/insights writes a report on how you work and where friction happens.
Status line. You can configure it to display context usage all the time.
Note: The dollar figure in /usage is meant for API users. Subscribers see plan usage bars instead.
9 Methods to Reduce Claude Token Usage
Method 1: Clear Between Tasks
This is the easiest win. When you switch to unrelated work, run /clear. Old context wastes tokens on every message that follows. Anthropic notes that /clear itself costs nothing.
Worried about losing the thread? Run /rename first so you can find the session later, then use /resume to return to it.
Method 2: Compact With a Focus
When you want to keep working on the same task, /compact summarizes the history. Tell it what matters:
/compact Focus on code samples and API usage
You can also set standing instructions in your CLAUDE.md file:
# Compact instructions
When you are using compact, please focus on test output and code changes
One warning: compacting reads the whole conversation it summarizes, so compacting a huge context is itself a large request. Compact earlier, not at the last minute. And if you just want a fresh start, /clear is cheaper.
Method 3: Choose the Right Model
Anthropic says Sonnet handles most coding tasks well and costs less than Opus. Save Opus for complex architecture decisions or multi-step reasoning. Switch with /model, or set a default in /config.
Subagents inherit your session’s model, so a switch to Opus carries over to them. For simple subagent jobs, you can set model: haiku in the subagent’s configuration. The docs also say that unexpectedly high spend often traces back to long, never cleared sessions or Opus left as the default.
Method 4: Trim MCP Servers
MCP tool definitions are deferred by default, so only tool names and server instructions enter your context until Claude uses a specific tool. Still, unused servers add clutter.
Run /mcp and disable servers you aren’t using.
Run /context to see what each one costs you.
Prefer command line tools like gh or aws when they exist. The docs say they’re more context efficient because they add no per-tool listing.
Method 5: Keep CLAUDE.md Lean
Your CLAUDE.md file loads at the start of every session. If it holds long instructions for specific jobs, like PR reviews or database migrations, those tokens ride along even when you’re doing something else.
Move specialized instructions into skills, which load only when needed. Anthropic suggests keeping CLAUDE.md under 200 lines and including only essentials.
Method 6: Write Specific Prompts
Vague requests trigger broad scanning. Specific ones let Claude read less.
Vague (costly) | Specific (cheaper) |
|---|---|
“Improve this codebase” | “Add input validation to the login function in auth.ts” |
“Fix the bug” | “The checkout page returns a 500 error when the cart is empty. Check cart.js.” |
Method 7: Plan First and Correct Early
Use plan mode. Press Shift+Tab to cycle to it. Claude proposes an approach for your approval before touching code, which prevents expensive rework.
Stop early. If Claude heads the wrong way, press Escape. Use /rewind or double tap Escape to go back to a checkpoint.
Give a way to verify. Include test cases or expected output so Claude can check its own work.
Test as you go. Write one file, test it, then continue.
Method 8: Keep Noisy Output Out of Your Context
Running tests or reading logs can flood your context. Two fixes:
Subagents. Delegate verbose work so the noise stays in the subagent’s context and only a summary comes back. The subagent still uses your allowance, so pick a smaller model for it.
Hooks. A hook can filter data before Claude sees it. Instead of Claude reading a 10,000 line log, a hook can return only the error lines, cutting tens of thousands of tokens to hundreds.
For typed languages, Anthropic also suggests code intelligence plugins. They let Claude jump to a definition rather than search and read several files.
Method 9: Lower the Thinking Effort for Simple Tasks
Extended thinking is on by default because it helps with complex planning. But thinking tokens are billed as output tokens, and the default budget can reach tens of thousands of tokens per request.
For simple tasks, lower the effort level with /effort or in /model. On several current models, you can’t turn thinking off entirely, so effort levels are the main control.
Why Long Sessions Burn Through Limits
A session left open for hours can use far more than your activity suggests. Anthropic lists the usual causes:
Long context. The full history is re-read on every request, even if at a cheaper cached rate.
Cache misses. Your first message after a break longer than the cache lifetime reprocesses your whole context.
Scheduled tasks and idle check-ins. These can fire while the session sits idle, each sending your full context.
Subagents and agent teams. Each runs its own context window. Agent teams use about 7 times more tokens than standard sessions when teammates run in plan mode.
Compacting a large context, as covered above.
The practical takeaway: finish a task, clear, and start the next one fresh.
Claude Usage Limit Tips; If You Already Hit the Wall
Check which limit it is. A session or weekly limit message means a seat based usage window shared across all models, so switching models won’t restore access. A model specific limit, such as an Opus limit, can be avoided by switching to a model outside that family.
Check the reset time. The message shows when your window resets. On Team and Enterprise plans, allowances reset on a rolling five hour window and a weekly window.
Consider usage credits. If your plan supports them, /usage credits lets you keep working past the allowance.
Let Claude wait and continue. On Claude Code v2.1.234 or later, it can wait for the reset and resume the interrupted task automatically.
Update Claude Code. Several of these features require newer versions. Run claude --version to check.
Quick Cheat Sheet
Situation | What to do |
|---|---|
Starting an unrelated task | /clear (after /rename if you want to return) |
Same task, long session | /compact with a focus, earlier rather than later |
Simple or routine work | Use Sonnet, and lower /effort |
Slow, bloated sessions | /context and /mcp, then disable unused servers |
Huge logs or test output | Subagents or a filtering hook |
Unsure where usage goes | /usage and /insights |
Common Mistakes to Avoid
Keeping one giant session open for days.
Leaving Opus as your default for everything.
Stuffing every rule you can think of into CLAUDE.md.
Running a vague prompt, then fixing the result with five follow ups.
Leaving scheduled tasks or extra servers running in the background.
References
Frequently asked questions
How do I save tokens in Claude Code?
Keep your context small. Use /clear between unrelated tasks, run /compact with a focus during long tasks, pick Sonnet for most work, trim unused MCP servers, and keep CLAUDE. md short and write specific prompts.
What uses the most tokens in Claude Code?
Usually the conversation history. Claude Code sends your full conversation with every request, plus tool results each time. Claude uses a tool, so long sessions get expensive. Subagents, agent teams, and extended thinking add more.
What is the difference between /clear and /compact?
/clear wipes the conversation history and starts fresh, and it costs nothing. /compact summarizes the history so you can continue the same task with less context, but it needs to read the whole conversation to do so.
How do I check my Claude Code token usage?
Run /usage for session usage and, on subscription plans, a breakdown of what counts against your limits. Run /context to see what fills your context window, or configure your status line to show usage continuously.
Does /clear delete my work?
No. It clears the conversation history, not your files. Run /rename first so you can find the session later, then use /resume to return to it.
Which Claude model saves the most usage?
Anthropic says Sonnet handles most coding tasks well and costs less than Opus, so reserve Opus for complex reasoning. For simple subagent tasks, you can set the model to haiku.
Do MCP servers use a lot of tokens?
MCP tool definitions are deferred by default, so only tool names and server instructions enter context until a tool is used. Still, disable servers you don’t use and prefer command line tools like gh when they exist.
How long should my CLAUDE.md file be?
Anthropic suggests keeping it under 200 lines with essentials only. Move specialized workflow instructions into skills, which load only when needed.
Why do I hit my Claude Code usage limit so fast?
Common causes are very long sessions, cache misses after breaks, subagents or agent teams, scheduled tasks firing in idle sessions, and a heavy default model. Use /usage to see which one applies to you.
What should I do when I hit my session or weekly limit?
Check the reset time in the message. Switching models does not help with a general session or weekly limit. You can use /usage-credits if your plan supports it, or wait, since newer versions of Claude Code can resume automatically after the reset.
Does extended thinking use more tokens?
Yes. Thinking tokens are billed as output tokens, and the default budget can be large. Lower the effort level with /effort for simple tasks.
Is /compact free?
No. Compacting reads the conversation it summarizes, so compacting a large context is itself a large request. Compact earlier, or use /clear for a fresh start.
Do these tips work on Pro and Max plans or only on the API?
They work on both, since the cause is the same: context size. The dollar figure in /usage is meant for API users, while Pro and Max subscribers see plan usage bars.
Written by
Muhammad Sohaib
Spotted a mistake? Report a correction · How we handle corrections
Keep reading
15 Best GitHub Repos for AI Developers Right Now
12 Best GitHub Repos for Web Development; Build a Website Faster
12 Best GitHub Repos for Claude Code Users