AI Tools
How to reduce your Claude Code token usage (and your bill)
Claude Code bills by tokens, and most of the waste comes from one place: a bloated context window. Here are eight practical habits that cut token usage and cost without slowing you down — and how to watch the numbers as you work.
Claude Code bills by the token, and almost all avoidable spend traces to one thing: an overstuffed context window. Every turn re-sends the whole conversation plus any files Claude has read, so a sprawling session quietly pays to re-transmit the same code again and again. Fix the context habits and the bill drops without your workflow slowing down. Here are eight things that actually move the number.
1. See the number first
You can’t cut what you can’t see. Run /usage for your plan limits, /cost for the current session, or npx ccusage for history — and for an always-on view, a menu bar meter like Usage keeps token spend in the corner of your eye. Our full walkthrough of the options is in tracking your Claude Code usage in real time.
2. /compact long sessions
When a session gets long but you want to keep going, /compact replaces the history with a summary — you keep the thread of what you’re doing while shedding the token weight of every earlier message. Reach for it when a task has run for a while and the context feels heavy.
3. /clear between unrelated tasks
Finished the bug and moving on to a new feature? /clear starts fresh so Claude stops carrying the last task’s messages and file contents into every new turn. It’s the single most effective habit here — a new task rarely needs the old one’s context.
4. Scope what Claude reads
Pointing Claude at “the repo” invites broad searches that pull large amounts of code into context. Name the specific files or folders that matter. A precise request (“update the auth handler in src/auth/”) reads far less than an open-ended one.
5. Give it a CLAUDE.md
A CLAUDE.md at the project root — conventions, key commands, structure, gotchas — means Claude doesn’t rediscover the same facts (and re-read the same files) every session. It’s a one-time write that pays back on every run.
6. Match the model to the task
The most capable model isn’t always the right one. Routine edits, renames and boilerplate are fine on a smaller, cheaper model; save the top model for genuinely hard reasoning and tricky debugging. Switching deliberately is easy money saved.
7. Prefer targeted edits over full rewrites
Asking for a small, specific change produces a small diff and reads less surrounding code than “refactor this file”. Break big changes into scoped steps — cheaper, and easier to review.
8. Lean on subagents for big searches
For sprawling “find where X happens across the codebase” work, a subagent can do the fan-out search and return just the conclusion, instead of loading every file it touched into your main context window. You keep the answer without keeping the haystack.
The one-line summary
Treat the context window as the thing you’re paying for, because it is. Watch it (/usage, a menu bar meter), keep it lean (/compact, /clear, scoped requests), and match the model to the job. Do that and Claude Code stays fast, focused and noticeably cheaper. Anthropic’s own Claude Code documentation covers each command in detail.
Frequently asked questions
What uses the most tokens in Claude Code?
The context window. Every turn re-sends the conversation so far plus any files Claude has read, so a long session or a big repository search inflates token counts fast. Managing context — compacting, clearing, and scoping what Claude reads — is where the biggest savings are.
Does /clear save tokens?
Yes. /clear starts a fresh conversation, so Claude stops carrying the previous session's messages and file contents into every new turn. Use it whenever you switch to an unrelated task; use /compact when you want to keep going but shrink a long history.
How do I see how many tokens Claude Code is using?
Run /usage inside Claude Code for your plan limits, /cost for the current session's spend, or npx ccusage in a terminal for daily and per-project history. A menu bar app keeps the number always visible.
Is a bigger context window cheaper or more expensive?
More expensive per turn, because you pay for the tokens in context on every request. A large window is useful when a task genuinely needs a lot of code in view, but leaving stale context around just to avoid re-reading is usually false economy — compact or clear instead.
Which Claude model should I use to save money?
Use a smaller, faster model for routine work — renaming, small edits, boilerplate — and switch to the most capable model only for hard reasoning or tricky debugging. Matching the model to the task is one of the simplest ways to cut cost.