Generative AI & LLMs

Context Window

In shortThe maximum amount of text, measured in tokens, that a language model can consider at once, including the prompt, retrieved content and its answer.

Updated 24 Oct 2026· 2 min read

A context window is the working memory of a large language model: all the text it can take into account when producing a response. It includes the system instructions, the user’s prompt, any documents retrieved for the answer, the conversation so far, and the response itself. Its size is measured in tokens, not words.

How it works

Text is split into tokens before it reaches the model; in English, a token is roughly four characters or three quarters of a word. Each model has a maximum context length, which has grown from a few thousand tokens in early models to hundreds of thousands or more in current ones. When content exceeds what fits, something has to give: the application may truncate it, summarise it, drop it, or retrieve only selected chunks.

Bigger is not automatically better. Research such as “Lost in the Middle” found that models use information at the start and end of long contexts more reliably than information in the middle, and Anthropic’s documentation notes that accuracy and recall can degrade as token count grows.

How it’s used in SEO and marketing

  • AI search: in a RAG pipeline, the top-ranked documents are loaded into the context window under a token budget, so a bloated page competes for space with other sources.
  • Agent readiness: MLforSEO’s agentic SEO course suggests keeping key product and category pages lean, removing boilerplate and converting heavy markup into compact tables or structured data.
  • Prompting: deciding how much brand guidance, examples and source material to include when using LLMs for content tasks.
  • Cost: API pricing is per token, so context size drives spend.

Example

The course describes an agent asked to find a waterproof hiking jacket under a set price. It fetches a retailer’s page, strips the HTML and counts about 193,000 tokens against a 200,000-token window. With the user’s question and other sources added, it does not fit, so the content is cut and the agent answers from other sources or guesses. A lean version of the same page with clear product data fits easily.

Limitations and things to watch

  • How each system handles overflow (truncation, skipping or summarising) is rarely documented and differs between products.
  • Advertised context sizes are maximums; retrieval systems usually give each source a much smaller share.
  • A large window does not give a model memory between separate conversations.
  • Token counts vary by tokenizer and language; non-English text often uses more tokens.

Learn it on MLforSEO

Where Context Window shows up on MLforSEO

Sources and further reading

Other terms from Generative AI & LLMs

See all 19 Generative AI & LLMs terms →