What is a context window, and why do long conversations get worse?
A context window is all the text a language model can reference when it generates a response — including the response itself. It isn't the same as what the model was trained on; think of it as working memory for this one conversation, not general knowledge.
Its size matters less than what's inside it: more context isn't automatically better, because accuracy and recall degrade as token count grows, a pattern known as context rot. Below: what fills the window without you noticing, how big it actually is depending on the model, what happens when you go over it, and what gets managed for you automatically.
What actually fills the context window
Every message you send and every reply the model gives accumulates inside the window as a conversation continues — earlier turns aren't summarized away on their own, they're preserved in full.
- The system prompt
- Every message in the conversation, including tool results, images and documents
- The definitions of every tool made available to the model
- The output generated in that turn, including extended thinking
Why more context isn't automatically better
This is the part that surprises most people, and it's the reason this page exists: a bigger window is not simply a bigger advantage.
The practical consequence is that curating what's in context matters just as much as how much space is available. A window with plenty of room to spare can still be full of the wrong thing.
How big it is, and what counts against it
Size depends on the model. Claude Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 5 and Sonnet 4.6 all have a 1M-token context window on the Claude API, Amazon Bedrock, Google Cloud and Microsoft Foundry — as do Claude Fable 5 and Mythos 5. Other models, including Claude Sonnet 4.5, have 200k.
In the 1M-token models, a single request can generate up to 128k tokens of output, and a request can include up to 600 images or PDF pages — 100 in the 200k models.
Every response reports exactly how much of the window it used, in a usage field. With prompt caching on, that input count splits into input_tokens, cache_read_input_tokens and cache_creation_input_tokens — and all three still count toward the window. Caching changes what those tokens cost you, not whether they take up space.
What happens when you go over it, and how it's managed for you
If the input alone is already bigger than the window, the API rejects the request outright with a 400 invalid_request_error saying the prompt is too long. In Claude 4.5 models and newer, it's less blunt: if input plus the max_tokens you asked for would exceed the window, the request is accepted anyway, and generation only stops if it actually reaches the limit, ending with stop_reason: “model_context_window_exceeded”.
There's also a token counting API for estimating how much of the window a request will use before you send it. And three things happen to manage the window for you, without being asked:
- Server-side compaction — in beta for Claude 4.6 and newer models — summarizes the older parts of a long conversation on Anthropic's server, and is the primary strategy for keeping one going past what would otherwise fit.
- Context editing offers tool result clearing and thinking block clearing — removing specific things from context instead of summarizing everything.
- Context awareness, in Claude Sonnet 5, Sonnet 4.6, Sonnet 4.5 and Haiku 4.5, lets the model track its own remaining budget — the API injects that information automatically, so there's nothing to turn on.
FAQ
What is a context window?
All the text a language model can reference when it generates a response, including the response itself — the system prompt, every prior message, tool results, tool definitions and the reply itself. It's different from the data the model was trained on; think of it as working memory for the current conversation, not general knowledge.
What is context rot?
The pattern behind why a bigger context window isn't automatically better: as token count grows, accuracy and recall degrade. It's why curating what's in context matters just as much as how much space is available.
How big is a context window, in tokens?
It depends on the model. Claude Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 5, Sonnet 4.6, Fable 5 and Mythos 5 all have a 1M-token window on the Claude API, Amazon Bedrock, Google Cloud and Microsoft Foundry. Other models, including Claude Sonnet 4.5, have 200k.
What happens when a request exceeds the context window?
If the input alone is already bigger than the window, the API rejects the request with a 400 invalid_request_error. In Claude 4.5 models and newer, input plus max_tokens exceeding the window is accepted, and generation stops with stop_reason: “model_context_window_exceeded” only if it actually hits the limit.
Read next
- Is the Claude certification worth it?What a Claude certification actually gets you, what it costs to keep it, and the numbers Anthropic does not publish — decide before you pay, not after.
- Which Claude certification should you take?Four Claude certifications compared: price, domains, prerequisites and Partner Network status — an honest pick by role: developer, architect or beginner.
- Who can take the Claude certification?Claude certifications require a Claude Partner Network company email — personal email won't work.
- What the Claude certification exam actually looks like120 minutes, a 720 passing score on a 100–1,000 scale, and the domain weights each Claude exam draws its questions from — what it measures, how it's scored.
- How to prepare for the Claude certification — and how long it takesHow to prepare for the Claude certification: what Anthropic provides, how to plan by domain weight, common mistakes, and how to estimate your readiness date.
- Claude certification practice questions — where to find real onesWhere to find practice questions for the Claude certification, what a real exam question looks like, and how to tell a useful one from a memorised dump.
- Claude certification exam day — what actually happensHow to schedule the Claude certification exam with Pearson, the 24-hour rule that forfeits your fee, what to do before the day, and how your score arrives.
- Claude Certified Associate — Foundations (CCAO-F)The entry-level Claude certification: $99, seven domains, 120 minutes, a 720 cut — what CCAO-F covers, who can sit it, and the one thing it does not unlock.
- Claude Certified Developer — Foundations (CCDV-F)The builder-level Claude certification: $125, eight weighted domains, 120 minutes, a 720 cut — and the single domain that's a third of the exam.
- Claude Certified Architect — Foundations (CCAR-F)The architect-level Claude certification: $125, 60 questions, five weighted domains and a 720 cut — plus what the CCA-F to CCAR-F rename did and didn't change.
- Claude Certified Architect — Professional (CCAR-P)The only professional-level Claude certification: $175, seven domains and a 720 cut — the flattest blueprint of the four, and what it adds over Foundations.
- What is MCP (Model Context Protocol)?MCP connects AI apps to external tools and data through hosts, clients, and servers.
- What are Claude Code hooks, and when to use them?Claude Code hooks are shell commands that run automatically at fixed points in a session, so behavior doesn't depend on the model remembering an instruction.
Managing context is a skill you can practice
AgentPrep drills the craft this page describes — original scenario questions and mastery tracked per area, in full on Telegram. Free to start in your browser, no card.
Start freeThree practice questions, answers explained
Leave your e-mail and we send you the three questions from our quiz with a commented answer key — each one written from published material, never recalled from a live exam.
Done — it's on its way to your inbox.
That didn't go through — check your connection and try again.