What is a context window in artificial intelligence?
The context window is the maximum amount of text, measured in tokens, that a language model can take into account at once when generating an answer: the instructions, the conversation, the documents it is given to read and its own answer. It is different from what the model learned in training, and what does not fit in it, the model does not see.
Key takeaways
- The context window is a model's working memory in one request: what is not inside it, the model cannot use to answer.
- It is measured in tokens and counts everything: instructions, messages, documents, images, tools and the answer the model writes.
- Current Claude and Gemini models accept up to a million tokens, but more context is not automatically better.
- Accuracy drops as the window fills up, and a fact buried in the middle of a long context is used worse than one at the start or the end.
- So what matters is less how much fits than what you put inside: the smallest set of useful information.
The context window is not a browser window or the "context" of a marketing plan: it is everything a language model has in front of it at the moment of answering. It matters to a store from two sides. When an assistant answers about your products, it can only use what of your page made it into that window, next to what came from other stores. And when a tool writes your product pages with an LLM (large language model), what decides which data gets used is what that tool puts inside.
How it works
Anthropic defines it as all the text a model can reference while generating a response, including the response itself. It is not the enormous corpus the model was trained on, but a "working memory".[1]Anthropic, Claude documentation. Context windows Google uses almost the same image: a short-term memory, with a limited capacity to hold information before generating the answer.[2]Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context
It is measured in tokens, the pieces of text the model splits what it reads into, and the count includes much more than the question. In Claude's API it counts everything that goes in the request: system instructions, every message in the conversation including tool results, images and documents, tool definitions and, on top of that, what the model generates in that turn, reasoning included.[1]Anthropic, Claude documentation. Context windows OpenAI sums it up in one rule: the request and the response together cannot exceed the model's maximum context length.[3]OpenAI, API documentation. Key concepts
The size has grown a lot. As of October 2026, current Claude models have a one-million-token window and can generate up to 128,000 output tokens per request; other models in the same family stay at 200,000.[1]Anthropic, Claude documentation. Context windows Gemini also accepts a million tokens, and Google translates that into things you can picture: about 50,000 lines of code, eight average-length novels or the transcripts of more than 200 podcast episodes.[2]Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context
When something does not fit, what happens depends on who manages the window. In Claude's API, if the input alone already exceeds the window, the request is rejected with a prompt-too-long error. Chat interfaces, by contrast, can drop the oldest part of the conversation to make room for the new.[1]Anthropic, Claude documentation. Context windows
More context is not better
Anthropic itself warns about it on the same page: a bigger window allows longer tasks, but as the number of tokens grows, accuracy and recall degrade, a phenomenon it calls context rot.[1]Anthropic, Claude documentation. Context windows Google gives a figure for the same problem: finding a single fact in a long context works around 99% of the time, but accuracy drops noticeably when several facts have to be found at once in the same context.[2]Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context
Position counts too. A study by Nelson F. Liu and six other authors, published in 2023 in the journal TACL, had several models answer questions with many documents in front of them. Performance was best when the relevant information was at the beginning or the end of the context, and dropped significantly when it was in the middle, even in models built for long contexts.[4]arXiv (Liu, Lin, Hewitt, Paranjape, Bevilacqua, Petroni and Liang; TACL 2023). Lost in the Middle: How Language Models Use Long Contexts That is why Anthropic's engineers treat context as a finite resource with diminishing returns, and their advice is to look for the smallest set of useful information that makes the result you want likely.[5]Anthropic, engineering blog (September 29, 2025). Effective context engineering for AI agents
In a store
A fictional example: a tool has to write the description of a travel tripod. It can fill the window three ways:
| What it puts in the window | What happens |
|---|---|
| Only the product title | It fits with room to spare, but the model has no weight or maximum load, and may fill them in with something plausible: an AI hallucination |
| The whole catalog and all the brand's manuals | It may not even fit; and if it does, the tripod fact is a needle among thousands, and accuracy drops when there is a lot to find[2]Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context |
| The product page, the merchant's answers and the manual excerpts that talk about that tripod | Little text and almost all of it useful: the small, relevant set Anthropic recommends[5]Anthropic, engineering blog (September 29, 2025). Effective context engineering for AI agents |
The third option is the one that follows from this page's sources. Clione, for example, does not send the whole catalog: with each product travel the store's instructions, up to 10,000 characters, the merchant's answers about that product and, if the store turns it on, the four most relevant excerpts from its documents, about 1,200 tokens.
The same holds in reverse for the assistants that read your site: your product page shares a window with other stores' pages, and enters in pieces, not whole. A fact that only makes sense with the rest of the page around it has fewer chances of being useful.
What people often confuse
That a window of a million tokens means the assistant has "read" your entire store, or that what fits in it is what the model knows about you. The window is what the model has in front of it in one specific request, which is different from what it learned in training,[1]Anthropic, Claude documentation. Context windows and that something fits does not guarantee it is used well: accuracy drops as the window fills up.[1]Anthropic, Claude documentation. Context windows
How to check it
- Look up the window and the output limit of the model your tool uses in the provider's documentation. They are two different figures, and both are measured in tokens.[1]Anthropic, Claude documentation. Context windows
- Count the tokens of a typical request before sending it. Anthropic recommends its token counting precisely so you do not go over the window.[1]Anthropic, Claude documentation. Context windows
- Take out what does not help. If the context carries the whole catalog to describe one product, trim it to what talks about that product.[5]Anthropic, engineering blog (September 29, 2025). Effective context engineering for AI agents
- Put the key facts at the beginning or the end of what you give the model, not buried in the middle of a long document.[4]arXiv (Liu, Lin, Hewitt, Paranjape, Bevilacqua, Petroni and Liang; TACL 2023). Lost in the Middle: How Language Models Use Long Contexts
- If an answer comes out cut off, look at the reason. In Claude's API, a generation that reaches the window limit stops with the reason
model_context_window_exceeded.[1]Anthropic, Claude documentation. Context windows
Related concept: RAG
RAG (retrieval-augmented generation) and the context window are explained together. Google says that models with small windows needed to retrieve only what was relevant, summarize or trim messages, and that a large window allows another route: giving all the relevant information up front.[2]Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context But context rot and the position effect are still there,[1]Anthropic, Claude documentation. Context windows[4]arXiv (Liu, Lin, Hewitt, Paranjape, Bevilacqua, Petroni and Liang; TACL 2023). Lost in the Middle: How Language Models Use Long Contexts so retrieving well has not stopped being useful. RAG decides what goes in; the window is the space it goes into.
To keep going, the entry on tokens explains the unit the window is measured in, and the reading path orders the rest of the terms.
Synonyms
- English
- context window, context length
- Español
- longitud de contexto
Sources
- [1] Anthropic, Claude documentation. Context windows. Accessed . ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
- [2] Google AI for Developers, Gemini API documentation (updated June 22, 2026). Long context. Accessed . ↑ ↑ ↑ ↑ ↑
- [3] OpenAI, API documentation. Key concepts. Accessed . ↑
- [4] arXiv (Liu, Lin, Hewitt, Paranjape, Bevilacqua, Petroni and Liang; TACL 2023). Lost in the Middle: How Language Models Use Long Contexts. Accessed . ↑ ↑ ↑
- [5] Anthropic, engineering blog (September 29, 2025). Effective context engineering for AI agents. Accessed . ↑ ↑ ↑
Change history
- First English version.
This definition is published under CC BY 4.0. Reuse this definition freely, crediting Clione with a link to this page.
Related terms
Token
What a token is in artificial intelligence, how many characters it takes, how OpenAI, Gemini and Claude count them and what they cost on your product pages.
RAG
What RAG is in AI, the paper it comes from, how Google and ChatGPT use it to answer with sources, and what part of your product page ends up in the answer.
LLM
What an LLM is, how it predicts the text it writes, why it makes up facts and what ChatGPT or Gemini do with your store's product page.
AI hallucination
What an AI hallucination is, why ChatGPT or AI Overviews can make up facts about your products, and how to check what they say about your catalog.
Topical authority
What topical authority is, what Google documents and what it doesn't, and how to build it in an online store with categories, product pages and links.
Semantic SEO
What semantic SEO is, which Google systems explain it, what Google doesn't document and how it applies to a product page, with an example.
Make your catalog easy for bots to read
Clione fills every product page with what bots read best: the JSON-LD graph with its structured data, the meta description and the FAQs. You review and press Push; then we check your live store so it all stays published.