Skip to content
← All concepts
Concept

Context Window

The maximum number of tokens an LLM can attend to in a single call.

What shares a single context window

Step 1 of 5

System prompt

Instructions and rules take tokens on every call.

Everything competes for the same token budget, and more is not automatically better.

Simple explanation

The context window is how much text the LLM can 'see' at once. If your prompt + history + retrieved context exceeds it, the model errors or truncates. Larger windows cost more.

Engineering explanation

Context windows range from 4k tokens (early models) to 1M or more on several current models; check each provider's model page for the current figure (model names change often; check your provider's model list (as of 28 October 2026).). Cost scales with input tokens — the input cost of a 100k-token prompt is 100x that of a 1k-token prompt. 'Lost in the middle': models attend less to content in the middle of long contexts. Context engineering (summarise, prune, order) manages the budget.

Example

Take a model with a 128k-token context window. A 50-page document is roughly 25k tokens, so it fits easily. A 500-page book is roughly 250k tokens, so it exceeds it.

When to use it

Always — every LLM call has a context window limit. Manage it with context engineering.

Common misconception

A larger context window does NOT mean better answers. 'Lost in the middle' means models attend less reliably to content in the middle of long contexts. More context ≠ better.