Part ofClaude Models Explained: Opus vs Sonnet vs Haiku
Claude's context window is its working memory: 1M tokens on Opus 4.8 and Sonnet 5, 200K on Haiku 4.5. What happens when it fills up, and how to manage it.
In This Article
7 sectionsThe Claude context window is the model's working memory, measured in tokens — one token is about 0.75 English words. Claude Opus 4.8 and Claude Sonnet 5 support 1 million tokens (roughly 750,000 words), while Claude Haiku 4.5 caps at 200K. Everything counts against it: the system prompt, your files, the chat history, and Claude's own replies.
We bump into these limits weekly — multi-hour Claude Code sessions, 400-page PDF reviews, chats that quietly stop remembering decisions made an hour earlier. So this guide covers the numbers that matter: exact Claude context window sizes per model and plan, what actually eats the window, what each surface does when it's full, and the habits that keep long sessions coherent.
What is a context window in Claude?
Every request to Claude is stateless. The model doesn't "remember" your conversation between turns — the full history gets sent back and reread every single time. The Claude context window is the ceiling on that: the maximum number of tokens the model can process in one request, covering the system prompt, every prior message, attached files, tool results, and the response it's currently writing. Anthropic's context windows documentation is explicit that input and output share one budget, which is worth internalizing — a long answer consumes space exactly like a long question.
A token is a chunk of text, usually three to four characters. In English prose, one token works out to roughly 0.75 words; code, numbers, and non-English text split into more tokens per line. For scale: the article you're reading is about 2,400 tokens. A 300-page technical book is around 120,000. That's the unit the Claude token limit is denominated in, and it's why "how many pages can I paste?" always converts back to tokens first.
Claude context window sizes by model
Here's the current lineup as served through the Claude API. Claude Opus 4.8 shipped May 28, 2026, and Claude Sonnet 5 followed on June 30, 2026 — both at the full million:
| Model | Context window | Max output | API price (per MTok in/out) |
|---|---|---|---|
| Claude Opus 4.8 | 1M tokens | 128K | $5 / $25 |
| Claude Opus 4.7 / 4.6 | 1M tokens | 128K | $5 / $25 |
| Claude Sonnet 5 | 1M tokens | 128K | $2 / $10 intro until Aug 31, then $3 / $15 |
| Claude Sonnet 4.6 | 1M tokens | 128K | $3 / $15 |
| Claude Haiku 4.5 | 200K tokens | 64K | $1 / $5 |
Those are API numbers. On claude.ai, the Claude context window you actually get depends on plan and model. The official Claude Help Center article lists 1M tokens for Claude Sonnet 5 on every paid plan — Pro at $20/month, Max 5x at $100, Max 20x at $200, plus Team and Enterprise — while recent Claude Opus and Sonnet models get 500K when chatting, and everything else defaults to 200K. Claude Code sessions reach the full 1M on newer models once usage credits are enabled. The free tier nominally has 200K too, but its message caps usually run out long before the window does.
For the full model-by-model picture — pricing levers, version naming, which tier fits which task — our pillar guide Claude Models Explained goes deeper.
What actually fills the Claude context window
People picture the window as "my messages plus Claude's answers." In practice five things share the Claude context window, and two of them are invisible in the UI:
- The system prompt and tool definitions. On claude.ai this is a few thousand tokens before you type a word. In Claude Code, tool schemas and loaded skill descriptions join it.
- Attached files. A PDF or codebase attachment is tokenized in full. One dense 100-page contract is ~50K tokens — a quarter of Haiku's entire window.
- The conversation history. Both sides, every turn, resent on every request.
- Tool results. Web searches, file reads, and command output land in the window too. In our sessions this is the silent killer — a single verbose test run can dump 10K tokens.
- Claude's own output. Thinking tokens and the visible reply both count, up to the 128K output cap on current models.
Run /context inside Claude Code and it shows this breakdown live. The first time we did, tool results outweighed our actual conversation three to one — which explains why sessions fill faster than the chat transcript suggests.
200K vs 1M: what the difference means in practice
Token counts are abstract, so here's the same comparison in units we actually plan work around:
| Measure | 200K tokens | 1M tokens |
|---|---|---|
| English words | ~150,000 | ~750,000 |
| Pages | ~500 | ~2,500 |
| Novels | ~2 | ~10 |
| Code (rough) | ~20,000 lines | ~100,000 lines |
So how big is the Claude context window in day-to-day terms? At 200K, Claude Haiku 4.5 comfortably holds a full audit of any single document, contract stack, or mid-sized module. The Claude 1M context on Claude Opus 4.8 and Claude Sonnet 5 is codebase-scale — a whole repository plus its docs in one request, which is exactly how we use it for cross-file refactors on this site.
Two caveats from experience. First, cost: input tokens bill per request, so genuinely filling 1M on Opus runs about $5 in input per call before any output — the math is laid out in our Anthropic Claude API pricing breakdown, and prompt caching exists precisely so repeated context costs a tenth of that. Second, reliability: a full window isn't a perfectly recalled window. Retrieval degrades toward the middle of very long contexts (researchers call it "lost in the middle," practitioners call it context rot), and the tiers differ in how gracefully they hold up — Opus degrades least, which is half the argument in our Claude Sonnet vs Opus comparison.
What happens when the Claude context window fills up
Each surface handles a full window differently, and knowing which behavior you're on saves real frustration:
| Surface | What happens at the limit | Your move |
|---|---|---|
| claude.ai chat | Paid plans with code execution enabled summarize earlier messages automatically; otherwise the chat stops with "Claude hit the maximum length for this conversation" | Ask for a handoff summary, start fresh |
| Claude API | Requests exceeding the window are rejected with a validation error; long generations can stop early with a context-exceeded stop reason | Trim history, or enable server-side compaction |
| Claude Code | Auto-compaction summarizes older turns near the threshold and the session keeps going | /context to inspect, /compact to trigger it deliberately |
The claude.ai behavior explains a pattern readers report constantly: Claude "forgetting" instructions from early in a long chat. Nothing malfunctioned — the summarization that keeps the conversation alive is lossy, and details that didn't make the summary are simply gone. Claude Code's compaction has the same trade-off, which is why we treat compaction as a checkpoint, not a free lunch: compact after finishing a task, not in the middle of one.
Long-context habits that actually work
After a year of running this site through Claude daily, these are the practices that survived:
- Front-load the big stuff. Put documents and code at the top of the prompt and questions at the end. Attention to the start of the context is stronger, and stable prefixes are what prompt caching can reuse.
- Start fresh at ~60–70%. When replies turn generic or Claude re-asks settled questions, the Claude context window is crowding out quality. Don't ride it to the hard limit — ask for a summary of decisions and open threads, then carry that into a new chat.
- Curate instead of dumping. Ten relevant files beat a hundred marginal ones. Claude context length is a budget; spending it on noise degrades recall of the signal.
- In Claude Code, manage deliberately.
/clearbetween unrelated tasks,/compactat natural checkpoints, and push durable facts into CLAUDE.md so they survive resets without re-pasting. - On the API, cache and compact. Prompt caching makes repeated long context ~90% cheaper, and server-side compaction keeps agent loops alive past the raw Claude token limit.
None of this is exotic. The teams that struggle with long contexts usually aren't hitting model limitations — they're treating a finite window as infinite and paying for it in coherence.
Claude pricing at a glance
| Plan | Price |
|---|---|
| Free | $0 |
| Pro | $20 / month |
| Max | from $100 / month |
| API | Pay per token |
For the full breakdown of every plan, see our how much Claude costs guide.
Frequently Asked Questions

Written by
InnovateTechie
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 →




