Skip to content
InnovateTechie
Claude Code

How to Check Your Claude Code Token Usage in a Session

EdithBy Edith15 min read
Share
Claude Code token usage shown as a context window breakdown from the /context command

Part ofWhat Is Claude Code? The Complete Guide

Quick answer

Learn how to check your Claude Code token usage in a session. Use /context to see the context window and /cost to track tokens, with quick tips to free space.

Key takeaways

  • /context shows a live breakdown of what fills the context window — system prompt, tools, memory files, messages, free space, and the autocompact buffer — with per-slice token counts.
  • /cost totals the session's tokens and estimated cost per model, including cache reads and writes; on Pro or Max that dollar figure is equivalent API value, not a bill.
  • On a subscription, /usage is the meter that matters: plan-usage bars for the rolling 5-hour and weekly limits, shared across Claude Code, Claude chat, and Cowork.
  • The context window caps at 1 million tokens on Claude Opus 5 and Sonnet 5 and 200,000 on Claude Haiku 4.5; auto-compact summarizes older history as you near the limit.
  • Chatty MCP servers can quietly eat a large share of the window before you type a word — run /mcp and disable the ones you are not using.

To check your Claude Code token usage, run /context in any session to see how much of the context window is filled — broken down by system prompt, tools, files, and messages — and run /cost for a token and cost summary. Both are built in, so you can see your Claude Code token usage at any moment without installing anything.

Command behaviour verified 31 July 2026 against Anthropic's Claude Code cost management documentation.

Every message you send in Claude Code carries the whole conversation with it: your prompts, Claude's replies, the files it has read, tool results, and a stack of instructions that load before you type a word. That bundle is the context window, and it has a fixed size. Knowing how full it is tells you how close you are to that ceiling — and whether it's time to trim, compact, or start fresh. Every step below was run by hand before publishing, so you are not testing our assumptions in production.

The good news is that you don't need a third-party dashboard for the essentials. Claude Code ships with commands that answer the two questions people actually ask: "how full is my context?" and "how many tokens have I spent?" This guide covers both, plus the statusline, auto-compact, and how subscription limits differ from the per-session context.

Key takeaway

To check Claude Code token usage, run /context for a live context-window breakdown and /cost for session token totals — both built in — while the context window itself reaches 1 million tokens on current models such as Claude Opus 5 and Claude Sonnet 5, and 200,000 on Claude Haiku 4.5.

The two built-in ways to check Claude Code token usage

Two native commands answer different questions. /context is a fuel gauge showing how full the window is right now; /cost is an odometer totalling what the session has consumed and what those tokens are worth.

There are two native commands, and they answer different questions:

  • /context tells you how full the current context window is right now — a live snapshot of what's occupying space.
  • /cost tells you how many tokens the session has consumed and what they would cost, with a per-model breakdown.

Think of /context as a fuel gauge (how much room is left this second) and /cost as an odometer (how much you have burned since the session started). Most people reach for /context first, because a full context window is what slows things down and triggers summarization.

/context: see how full your context window is

/context draws a coloured grid breaking the window into system prompt, tools, memory files, messages, free space, and the autocompact buffer — each labelled with its token count, so you can see exactly what is crowding you out.

Type /context and press Enter. Claude Code draws a colored grid and a category breakdown showing exactly what is filling the context window. Typical categories include:

  • System prompt — the core instructions Claude always loads (you never see these).
  • Tools — definitions for the system tools and any MCP tools Claude can call.
  • Memory files — your CLAUDE.md and any auto memory.
  • Messages — the full conversation history, usually the biggest and fastest-growing slice.
  • Free space — what is left for new work.
  • Autocompact buffer — a reserve Claude Code keeps for automatic compaction.

Each slice is labeled with its token count and share of the window, so you can see at a glance whether your Claude Code token usage is dominated by a giant file you read, a chatty MCP server, or just a long conversation. Recent versions even surface suggestions — for example, flagging an MCP server that is eating tokens or a memory file that is too large. The official context window guide has an interactive breakdown of everything that loads at startup.

Run /context before a big task. If the window is already half full from earlier work, you will get better results by clearing first (more on that below) than by piling a complex job onto a cluttered context.

We build and maintain this whole site inside Claude Code, so /context is genuinely part of our daily muscle memory. The one thing that surprised us most when we started watching it closely was how much of the window a couple of chatty MCP servers ate before we typed a single word — the "tools" slice was quietly larger than most of the files we were reading. Running /mcp and turning off the servers we were not actively using bought back more room than any amount of /clear did.

Claude Code token usage breakdown shown by the /context command as a colored grid

/cost: tokens and dollars for the session

/cost reports the running total: an estimated session cost, API duration, and a per-model split across input, output, cache-read, and cache-write. The dollar figure is computed locally, so treat it as a guide rather than an invoice.

Where /context shows the current state, /cost shows the running total. Type /cost and you will see the session's total cost estimate, API duration, and a per-model breakdown split into input, output, cache-read, and cache-write tokens. That cache split is useful: prompt caching means repeated content (like your system prompt) is far cheaper on later turns, and /cost shows how much you are saving.

The dollar figure is an estimate computed locally from token counts, so treat it as a guide rather than an invoice. For authoritative billing on an API plan, the Claude Console usage page is the source of truth. If you want a deeper look at what a session actually runs you, our guide to Claude Code cost walks through the numbers.

/usage: subscription plans vs raw session cost

On Pro or Max the /cost dollar figure is not a bill — it is the equivalent API value of tokens already covered by your plan. /usage is the command that matters there, showing rolling allowance bars instead.

Here is the distinction that trips people up. If you are on a Pro or Max subscription, your Claude Code usage is included in the plan — so the dollar figure from /cost is not a bill you will pay. It is just the equivalent API value of the tokens you moved.

For subscribers, the command that matters is /usage. It shows the same session block plus plan usage bars: how much of your rolling allowance you have used, activity stats, and a breakdown attributing recent usage to skills, subagents, plugins, and individual MCP servers. Press d or w to toggle between the last 24 hours and the last 7 days. Anthropic's cost management docs spell out exactly what each block shows. In short: on a subscription, /cost answers "what did these tokens weigh?" and /usage answers "how much of my plan is left?"

Why does ccusage show more than my plan costs?

Because the headline figure is an API list-price equivalent, and in agentic sessions most of the tokens counted are cache reads — billed at roughly a tenth of the input list price. Weight the mix properly and a reported "$800 month" is usually worth somewhere around a quarter to a third of that in real API spend.

Third-party trackers such as ccusage read the same local session logs Claude Code writes, total the tokens, and multiply them by published API rates. That is a genuinely useful number, but it is an equivalent, not an invoice — and how people read it is where the confusion starts. A developer on a $200 Max 20x plan sees "$800 of usage this month", concludes the plan is returning four times its price, and then cannot square that with anything Anthropic says about its own economics.

The gap is almost entirely cache reads. Every turn of an agentic session re-sends the whole working context: your CLAUDE.md, the files already read, the tool results, the conversation so far. Prompt caching means that bulk is charged at about 10% of the input list price rather than in full, and in a long coding session it is the overwhelming majority of the token count. Price those tokens as ordinary input and the total inflates several-fold.

Here is the arithmetic at Sonnet 5 list rates — $3 input and $15 output per million tokens, cache reads at roughly 10% of input, cache writes at roughly 1.25x input — for one heavy month:

Token typeVolumeNaive (all non-output at $3/MTok)Cache-adjusted
Fresh input5M$15$15
Cache writes20M$60$75
Cache reads220M$660$66
Output4M$60$60
Total249M~$795~$216

Same logs, same list prices: a headline of about $800 against a properly weighted figure of about $216, or roughly 27% of the naive number. Read against a $200 Max 20x subscription, that is close to break-even rather than a four-fold bargain.

Two honest caveats. First, the adjustment factor is a reasoned estimate, not an official figure. Across the agentic sessions we have measured, cache-adjusted totals tend to land somewhere around 25-35% of a list-price headline, but the real ratio depends entirely on your own cache-hit rate, model mix, and session length — a Haiku-heavy day and an Opus-heavy day are not comparable. Anthropic publishes no multiplier for this, and anyone quoting one as official is guessing. Second, the better-maintained trackers do price cache reads separately; the inflation is often in how the headline is interpreted, or in a stale per-model rate table, rather than in the arithmetic itself.

The fix is to stop treating the headline as the answer and read the split underneath it. /cost breaks the session into input, output, cache-read, and cache-write lines — and when the cache-read row dwarfs the others, you already know the dollar figure above it is a list-price ceiling rather than a bill. If you want to check the comparison from the other direction, our plan calculator prices a week of your real hours and model mix against each subscription tier, so you can see which side of break-even you are actually on.

Every built-in meter at a glance

Six surfaces cover the whole picture: /context for a live breakdown, /cost for session totals, /usage for plan allowance, the statusline for continuous watching, /compact to free space, and /clear to reset entirely.

Here is a quick reference for every built-in meter:

Command / featureWhat it showsWhen to use
/contextLive context-window breakdown by category, with free space and autocompact bufferBefore a big task, or when replies slow down
/costSession token totals and estimated cost, per model, incl. cache read/writeTo gauge tokens spent this session (API billing)
/usageSession block plus plan usage bars and per-feature breakdownOn Pro/Max/Team to see how much plan allowance is left
StatuslineLive context/token indicator at the bottom of the sessionTo watch usage continuously without a command
/compactSummarizes history to free space (auto-runs near the limit)When context is nearly full but you want to continue
/clearResets the conversation to an empty contextWhen switching to unrelated work

How do you show token usage live in the statusline?

Running a command works, but the statusline puts the number on screen permanently. It displays a live context indicator at the bottom of the session, so the gauge moves as you work instead of only on demand.

Running a command is fine, but the fastest way to keep an eye on things is to put the number on screen permanently. Claude Code's statusline can display a live context or token indicator at the bottom of your session, so you see the gauge move as you work instead of stopping to run /context. It is a one-time setup and well worth it for anyone who runs long sessions.

Claude Code token usage indicator displayed live in the statusline at the bottom of a session

What auto-compact means for your token usage

Claude Code summarizes older history automatically as you approach the limit, so a reading can drop sharply mid-session. Startup content reloads afterward; only the skill listing does not fully return.

You do not have to babysit the gauge, because Claude Code compacts automatically as you approach the limit. When the conversation grows close to the model's maximum input size, Claude Code summarizes older history into a structured summary and frees the space — a full context window does not end your session.

Auto-compact changes what "usage" means over a long session. Your /context reading can suddenly drop after a compaction pass, because thousands of tokens of old back-and-forth just became a short summary. Startup content — system prompt, CLAUDE.md, memory, MCP tools — reloads automatically afterward; the one thing that does not fully return is the skill listing. You can also run /compact yourself with a focus, like /compact focus on the auth bug fix, before starting a long new task, so the summary keeps what you care about instead of what the automatic pass guesses.

Subscription limits vs the context window

Two different meters both get called usage. The context window covers this conversation and resets when you clear it. Plan usage covers your subscription rolling 5-hour and weekly limits, shared across Claude Code, chat, and Cowork.

It is worth separating two very different meters, because both get called "usage":

  • Context window — the tokens in this conversation, measured by /context. It resets when you /clear or start a new session, and it is capped by the model (1 million tokens on Claude Opus 5 and Claude Sonnet 5, 200,000 on Claude Haiku 4.5).
  • Plan usage — your subscription's rolling limits, measured by /usage. On Pro and Max these reset on a 5-hour window plus a weekly cap, and they are shared across Claude Code, Claude chat, and Cowork.

You can hit either one independently. A single massive file can fill your context window while your plan usage is barely touched; conversely, many small sessions over a busy afternoon can bump the 5-hour limit without any one context ever getting full. Understanding which meter you are near is the key to reading either number correctly.

Tips to keep Claude Code token usage low

Five habits do most of the work: check the window before big tasks, clear between unrelated jobs, scope file reads narrowly, disable MCP servers you are not using, and compact with an explicit focus.

A few habits keep consumption lean and your sessions fast:

  • Check /context before big tasks. Start complex work on a clean-ish window so the model has room to think.
  • /clear between unrelated jobs. Stale context costs tokens on every message. Use /rename first if you might want to /resume later.
  • Keep files scoped. Ask for specific files or functions rather than "read the whole repo" — every file you pull in stays in context.
  • Trim MCP servers. Run /mcp and disable ones you are not using; their tool definitions add up.
  • Let auto-compact work, or compact with a focus when you want to steer what survives.

Do those and you will rarely be surprised by a full window, and the token usage you see in /context and /cost will stay predictable session after session. Claude Code currently runs on the latest models like Claude Opus 5 and Claude Sonnet 5, and this guide is reviewed regularly so the /context and /cost steps stay accurate.

Frequently Asked Questions

Run /context to see how full the context window is, broken down by category, and /cost to see the token totals and estimated cost for the session so far. On a Pro or Max subscription, add /usage to see how much of your plan allowance you have used. All three are built in — no plugin required.

/context is a live snapshot of the current context window — how much space each part of the session is using right now. /cost is a running total of the tokens the session has consumed and their estimated cost, broken down per model. Use /context to manage space and /cost to track spend.

No. On a subscription, your Claude Code token usage is included in the plan, so the dollar figure in /cost is just the equivalent API value of the tokens, not a charge. To see how much of your plan you have actually used, run /usage and read the plan usage bars.

Claude Code auto-compacted. As you near the context limit, it summarizes older history to free space, so your /context reading falls after a compaction pass. Your session continues normally; startup content reloads and a structured summary replaces the long history.

Configure your statusline to display a live context or token indicator at the bottom of the session. It updates as you work, so you can watch your Claude Code token usage continuously instead of pausing to run /context each time.

Use /clear to empty the conversation and start with a fresh context window — the cleanest way to drop your per-session Claude Code token usage back to near zero. Note that this only resets the context window; it does not affect your subscription's 5-hour or weekly plan limits, which reset on their own schedule.
Edith

Written by

Edith

Writing about Claude and the Anthropic toolkit — models, Claude Code, pricing, features, and fixes, in clear, practical, hands-on guides tested by daily use.

View all posts →