Context window
A context window is the maximum amount of text, counted in tokens, that a language model can consider at once, covering the system prompt, conversation, documents, tool results and the response it writes.
Also called: context length, max tokens, long context, 1M context
By Divya Sharma · Checked Nov 15, 2026 · How we review
The context window works as the model's working memory for a request. It is separate from what the model learned in training. If something is not in the window, the model cannot see it.
What counts
Everything you send counts: the system prompt, every earlier message, pasted documents, images, tool definitions and tool results. The output counts too, including any hidden reasoning. Sizes are measured in tokens, not words or characters.
Long context
Long context refers to models with very large windows. Anthropic's documentation, for example, lists a context window of up to 1M tokens depending on the model. A "1M context" label means about a million tokens fit in one request. That is enough for a large codebase or several long reports.
Limits
A bigger window is not automatically better. Anthropic notes that accuracy and recall degrade as the token count grows, an effect called context rot. Long prompts also cost more and take longer, and the KV cache that holds them uses memory on the server. That is why context engineering, choosing what goes into the window, matters as much as its size.
Related terms
- Token (LLM)
- A token (LLM) is the basic unit of text a language model reads and writes, often a word, part of a word, a punctuation mark or a byte. Prices, speed and context limits are all counted in tokens.
- KV cache
- A KV cache stores the attention keys and values a transformer has already computed for earlier tokens, so each new token only needs work for itself. It speeds up generation but takes GPU memory that grows with context length.
- Context engineering
- Context engineering is the practice of choosing and maintaining everything that goes into a language model's context window during a task: instructions, retrieved documents, tool definitions, tool results and conversation history.
- Context rot
- Context rot is the drop in a language model's accuracy and reliability as its input grows longer, even when the input still fits inside the context window and the needed information is present.
- Context compaction
- Context compaction is the step where an agent summarises a conversation that is nearing its context window limit and continues in a fresh window that starts from that summary, so a long task can keep going.
- Output tokens
- Output tokens are the tokens a language model generates in its reply. They are counted and billed separately from input tokens, and a max_tokens setting caps how many one response may contain.