In short. A context window limits how much retrieved evidence a model can receive alongside instructions, conversation history and generated output.
Definition: A context window is the amount of information a language model can reference while generating a response, including the response itself. It is measured in tokens, units that can represent words, word fragments or characters, and sets a capacity limit for retrieved page content supplied to the model.
Key facts
- As of 17 October 2026, Anthropic's context window documentation counts application instructions, conversation messages, tool results and generated output toward the window.
- Microsoft's document chunking guidance explains how dividing documents into smaller parts helps meet model input limits.
- Liu and colleagues' Lost in the Middle, published in 2024, reports lower performance when relevant information appears in the middle of long inputs in the tested models.
- Anthropic's token counting documentation provides a way to estimate input size before submitting a message.
What consumes the available capacity?
Anthropic's glossary defines tokens as units that can correspond to words, subwords, characters or bytes. A page's word count therefore differs from its token count.
In Anthropic's context window documentation, the system prompt, meaning instructions supplied by the application, shares capacity with conversation history and documents. Tool definitions and tool results also count. Retrieved content competes for space with these inputs and the generated answer.
The same documentation describes compaction as summarizing earlier conversation content to continue a long conversation. Cached prompt content still occupies context capacity.
How do retrieved pages enter the window?
Retrieval-augmented generation, or RAG, combines document retrieval with answer generation. Anthropic's glossary explanation describes relevant information being retrieved for a query and passed to the model alongside that query. This places the selected evidence inside the context window.
Document chunking means dividing a document into smaller parts. Microsoft's chunking guidance describes using HTML or Markdown headings to divide content by section. It also gives the example of appending a document title to chunks taken from the middle, preserving their context.
For website editors, these examples support keeping sections understandable when extracted: a passage needs enough surrounding information to identify its subject. This is an editorial implication of the documented chunking methods.
Does fitting the evidence ensure accurate use?
Input capacity and evidence use are separate considerations. Lost in the Middle evaluates answering questions across multiple documents and retrieving values associated with keys. In those experiments, performance is often highest when relevant information appears near the beginning or end of the input, with degradation when it appears in the middle.
These results concern the models and tasks evaluated in that paper. They make evidence placement a relevant test condition when evaluating a retrieval system, alongside whether the assembled input fits the model's window.
How is input size checked?
Anthropic's token counting endpoint accepts structured message inputs, including system prompts and tools, and returns an input token estimate. Its basic-message example returns:
{ "input_tokens": 14 }
This value belongs to the documentation's example message. The same documentation advises counting against the model intended for use and describes the result as an estimate that can differ slightly from actual message usage.
Related terms
FAQ
How many web pages can fit in a context window?
A fixed page count cannot express the capacity: Anthropic's glossary explains that token representation depends on the model and language. The selected page text also shares space with the rest of the request and the response.
Does caching let me fit more page text?
Anthropic's context window documentation states that cached prompt prefixes still occupy the window. Caching changes the cost of those tokens while their context usage remains.
Sources
- Anthropic, "Context windows", accessed 17 October 2026
- Anthropic, "Glossary", accessed 17 October 2026
- Microsoft, "Chunk large documents for RAG and vector search in Azure AI Search", 2 July 2026
- MIT Press / ACL Anthology, "Lost in the Middle: How Language Models Use Long Contexts", 2024
- Anthropic, "Token counting", accessed 17 October 2026
Check how a page reads to answer engines. Open the GEO score analyzer