What Is a Context Window? A Simple Explanation with Examples
A context window is the maximum amount of text an AI can consider at once, measured in tokens. It includes your message, the conversation history, any documents you provide, and the answer it generates.
The short definition
The context window is the working memory of a language model for a single request. Everything the model needs to reference must fit inside it. Once content falls outside the window, the model cannot see or use it.
An analogy: a desk, not a library
Imagine a desk of fixed size. You can spread out notes, a book, and a letter, and while they sit on the desk you can reference them instantly. The library behind you holds far more, but you cannot look at anything unless it is placed on the desk.
The context window is the desk. Training data is the library — enormous, but not directly visible during a conversation.
What counts toward the limit
The window holds four things together:
- Your current prompt.
- Earlier messages in the conversation.
- Uploaded documents and pasted text.
- The model's output as it is generated.
A long conversation or a large document consumes the same shared budget.
What happens when you exceed it
- You may get an error asking you to shorten the input.
- The oldest messages can be dropped, so the model "forgets" earlier details.
- A long document may be summarized without its beginning being considered.
- Quality can drop as the model works with less relevant context.
Why bigger is not always better
A larger window is useful, but there are trade-offs:
- Processing more tokens costs more and can be slower.
- Models do not always use every token equally well; details in the middle can be underweighted.
- Costs rise with the volume processed.
- Long-context models still need verification for facts buried in documents.
Practical tips
- Start a new chat when switching topics rather than carrying old context.
- For long documents, ask for section summaries, then a summary of summaries.
- Remove irrelevant history before an important request.
- Put the most important instructions near the beginning or end of a long prompt.
- Match the model's window to the task; everyday questions rarely need the largest one.
Context window vs memory
| Context window | Memory | |
|---|---|---|
| Scope | One request | Stored across interactions |
| Nature | Fixed capacity | A feature added by the product |
| Content | Everything in the current chat | Selected facts and preferences |
| Limit | Token-based | Policy and feature-based |
Frequently asked questions
How big is a typical context window? Sizes vary widely by model and product, from modest windows to ones holding hundreds of thousands of tokens. Check the current model specification.
Does a bigger window mean smarter answers? Not by itself. It allows more reference material, but reasoning quality depends on the model.
Why did the AI forget something I said earlier? If it left the window, the model can no longer access it. Start a focused chat or restate the detail.
Can I feed in a whole book? Technically, if the book fits the window, but the model may not weight every chapter equally, so verify key points.
Key takeaways
- A context window is the token-based working memory for one request.
- It holds prompts, history, documents, and output together.
- Exceeding it causes errors or forgotten content.
- Use focused chats and section summaries to work within it.
Read next: what a token is and how to summarize long PDFs with AI.
Sources
Learn by doing
Read a guide, then practice with bite-sized AI lessons you can take offline.
Start learning free