What Is a Context Window in AI? Sizes, Limits and Tips
A context window is the most text an AI model can take into account in one request, counting both what you send and what it writes back. It’s measured in tokens, and a token is roughly three quarters of an English word. Anything outside the window, the model simply can’t see.
Comparing models? See the AI model context window comparison for 2026: every major model’s window, output limit and price, side by side.
Why it matters
The window sets what an agent can hold in mind at once: a contract, a codebase, a long conversation, the results of every tool it called. Run past it and something has to go, usually the oldest messages, and the agent starts forgetting what it was doing.
Most frontier models now accept a million tokens or more. That number is less useful than it sounds. Quality drops well before the limit, often at 60 to 70% of it, and every model tested gets worse as the input grows. Information buried in the middle of a long input is the easiest to lose. A bigger window also costs more per request, since you pay for every token you send, again, on every call.
How big is a context window?
| Window | Words | Pages of text | Lines of code |
|---|---|---|---|
| 64K tokens | about 48,000 | about 130 to 190 | about 6,400 |
| 128K tokens | about 96,000 | about 250 to 380 | about 12,800 |
| 200K tokens | about 150,000 | about 400 to 600 | about 20,000 |
| 1M tokens | about 750,000 | about 2,000 to 3,000 | about 100,000 |
Figures are approximate: the exact count depends on the model’s tokenizer and the kind of text. Code, tables and non-English text use more tokens per word.
What fills the context window
Everything the model reads in a request counts, not just your question:
- The system prompt and any standing instructions, such as an AGENTS.md or CLAUDE.md file.
- The conversation so far, every message in both directions.
- Documents and files you or the app added.
- Tool definitions and tool results: for an agent, often the biggest part, since every command output and file it reads stays in the window.
- The model’s answer, which shares the same budget. Models also have a separate limit on how much they can write in one reply.
Context window vs memory vs training data
- Context window: what the model can see in this request. It’s gone when the request ends unless the app sends it again.
- Memory: notes an app saves and puts back into the window in later sessions. It feels like the model remembers; really, the app re-sends it.
- Training data: what the model learned before release. It’s built in, but has a cutoff date and doesn’t include your private data.
What happens when you hit the limit
The app has to drop or shrink something. Chat apps usually drop the oldest messages. Coding agents often compact: they summarize the session so far and carry on with the summary. Either way, details get lost, which is why long sessions drift. Starting a fresh session for a new task, with only what it needs, often works better than pushing one session to the limit. The gradual loss of quality as the window fills is called context rot.
Using it well
Put the most important material at the start and the end, keep the middle for supporting detail, and send only what the task needs. For large collections of documents, retrieving the relevant parts usually beats loading everything into the window.
A few more habits that help:
- Keep standing instructions short. They’re re-sent on every request.
- Use prompt caching where the model supports it, so repeated material costs less.
- Split big jobs. Subagents each get their own window and return only a summary.
- Choose the window you need, not the biggest one. A smaller window with the right material often beats a huge one full of noise.
Deciding what goes into the window at each step is called context engineering.
Related
-
What is a context window in AI?
The most text an AI model can take into account in one request, counting both what you send and what it writes back, measured in tokens. -
How many words is 128K tokens?
About 96,000 English words, or roughly 250 to 380 pages. A 1M-token window holds about 750,000 words. -
Is a bigger context window always better?
No. Quality drops before the limit, information in the middle of long inputs is easiest to lose, and you pay for every token you send. Sending only what the task needs usually works better. -
What happens when a conversation exceeds the context window?
The app drops or summarizes older material. Chat apps usually drop the oldest messages; coding agents often summarize the session and continue, losing some detail. -
Is the context window the same as memory?
No. The context window is what the model sees in one request. Memory is information an app saves and puts back into the window in later sessions.