The LLM Context Window, Explained

Key takeaways
- An LLM context window is a temporary working space. It contains the current prompt, instructions, conversation history, retrieved information, tool results, and the model's output.
- A larger window does not guarantee a better answer. Models may accept long inputs without reliably finding or connecting all the relevant evidence inside them.
- Short and long context describe workload requirements, not universal token categories. Use more context only when the task genuinely depends on additional evidence or distant relationships.
- Signal density matters more than filling the window. Remove irrelevant or obsolete material while preserving the structure and explanation needed to interpret important evidence.
- TinyFish keeps unnecessary web data out of the host model's context: Fetch returns cleaner page content, while Web Agent handles intermediate browser execution externally.
Larger LLM context windows raise how much information an application can submit in one request, but they do not make irrelevant tokens useful. Navigation, repeated history, stale tool output, and other noise still occupy the active context and, on token-priced APIs, are billed as input. The optimization target is therefore task-relevant signal per unit of active context: how much of the working window directly helps the model complete the current task.
This guide explains what an LLM context window contains, how it works, why maximum capacity differs from usable context, and when shorter or longer context is appropriate.
What is an LLM context window?
An LLM context window is the maximum amount of tokenized information a model can consider within one request. AI tokens are fragments of text or other inputs rather than a fixed number of words. Tokenization varies by model, language, formatting, and content type, so the same document can occupy different amounts of context in different systems.
The window acts as a temporary working space. A typical request can include:
- System and developer instructions
- The user's current prompt
- Previous conversation turns
- Retrieved files, documents, and webpage content
- Tool definitions, calls, and results
- Working state supplied by an agent framework
- Reasoning or thinking tokens, where applicable
- Space required for the final response
Suppose an application sends 50,000 tokens of instructions, history, and retrieved evidence to a model with a 128,000-token context window. Those inputs have already consumed part of the available capacity. The application must still leave room for later tool results, any reasoning tokens counted by the provider, and the answer. A 128,000-token window is therefore not equivalent to 128,000 tokens of usable source material.
Web extraction shows how quickly context capacity can be consumed by low-value content. In one comparison from TinyFish's Fetch quality evaluation, TinyFish returned 4,737 characters at an 86.7% signal ratio, while Firecrawl returned 171,095 characters at a 19.3% signal ratio. The benchmark defines signal as useful content and distinguishes it from page noise such as navigation, ads, and cookie banners. Both outputs would occupy the receiving model's context, but the difference illustrates why context quality matters alongside context size: a larger payload can consume substantially more of the available window without providing proportionally more useful evidence. These figures should remain character counts and signal ratios rather than be converted into token savings, because the evaluation did not tokenize the outputs with a specified model tokenizer.
When a request reaches the model or endpoint's limit, the application may reject it, truncate material, retrieve fewer sources, compact previous turns, or require a new session. Response quality can also deteriorate before the technical limit when relevant information becomes difficult to locate among repeated instructions, stale decisions, logs, or webpage noise.
How do LLM context windows work?
Before a model processes a request, its tokenizer converts the input into tokens. The model then uses the information available within the current window to generate its response. It does not automatically retain every detail from earlier requests unless the application sends that information again or retrieves it from an external system.
Nevertheless, provider definitions are not always identical. Some providers publish a combined context budget, while others document separate input and output limits within a larger total window. Applications may also impose endpoint-specific restrictions. Developers should therefore check the documentation for the exact model and endpoint they intend to use.
The following four metrics should be treated separately:
- Advertised context window: The maximum combined capacity documented for the model or endpoint.
- Maximum input: The largest input the endpoint accepts, where separately specified.
- Maximum output: The upper limit for generated tokens.
- Effectively usable context: The amount of information the model can use reliably for a particular workload.
The first three are technical specifications. The fourth must be evaluated using realistic tasks.
Does a larger context window produce better answers?
Not necessarily. A larger window increases how much information a model can receive, but response quality also depends on whether the necessary evidence is relevant, clearly structured, and easy to locate. This is the difference between technical capacity and usable context.
The peer-reviewed LongBench v2 benchmark evaluates 503 realistic long-context problems across six categories: single-document QA, multi-document QA, long in-context learning, long-dialogue history understanding, code-repository understanding, and long structured-data understanding. It was designed to test deep understanding and reasoning over realistic long inputs. Evidence placement creates another gap between available and usable context. The 2024 paper Lost in the Middle: How Language Models Use Long Contexts varied where answer-bearing information appeared in multi-document question-answering and key-value retrieval tasks. The evaluated models generally performed better when the relevant information appeared near the beginning or end of the input and worse when it was buried in the middle.

Consider an agent comparing the security policies of three software vendors. Sending 20 complete webpages followed by the comparison question gives the model substantial context, but it also makes the decisive evidence compete with navigation, repeated legal language, and unrelated product information.
A better input begins with the required decision and criteria, such as authentication, data retention, and deployment options, and then provides labelled passages from each vendor's official documentation. Secondary material can be retrieved when it resolves a remaining uncertainty.
This does not mean every prompt should be compressed as aggressively as possible. In Dettori et al.'s controlled retrieval experiments, performance generally declined as prompts of similar length contained more distinct information. The results support an important distinction: removing irrelevant content can improve signal density, while aggressively compressing necessary evidence can make the remaining context harder to use.
This study uses lexical density to describe how quickly distinct information is introduced, whereas this article uses signal density to mean how much of the active context is task-relevant evidence.

High signal density therefore does not mean maximizing unique facts per token. Remove irrelevant and duplicated material, but preserve headings, labels, relationships, and explanations that help the model interpret the evidence. If a task requires many independent facts, staged retrieval may be more reliable than compressing everything into one dense request.
When does more context actually help?
There is no universal token threshold separating short- and long-context workloads. The appropriate length depends on how much necessary evidence the model must hold and connect.
Adding context increases signal when the new material supplies a missing fact, contrasting source, distant dependency, earlier decision, or evidence required for verification. It dilutes signal when it repeats established information, introduces unrelated background, preserves completed tool traces, or includes entire sources where only a small passage affects the answer.
A practical test is:
If removing this information would make the answer less accurate, less complete, or harder to verify, keep it. If the task can reach the same reliable conclusion without it, retrieve it later or leave it out.
Table 1. Risks of irrelevant information entering a context window based on typical workloads
| Workload | Typical context requirement | Main risk |
|---|---|---|
| Focused classification or extraction | A small, targeted source set | Supplying background that does not affect the result |
| Document analysis | The relevant sections plus enough surrounding context to interpret them | Burying decisive passages inside the full document |
| Repository-scale coding | Selected code, dependencies, configuration, and external state | Stale files and duplicated tool output |
| Multi-step agents | Selective context across repeated calls | Conversation history and intermediate results accumulating |
| Long-form synthesis | Multiple deliberately selected sources | Conflicting, repeated, or excessively compressed evidence |
For example, diagnosing a failure inside one function may require only the error, the function, its caller, and the relevant configuration. Loading an entire repository would only add unnecessary volume. On the other hand, diagnosing the same failure across an authentication service, API gateway, and client application may require traces, configuration, and code from all three systems. In that case, longer context preserves necessary relationships.
What unnecessary context costs across representative models
A large context ceiling determines how much input a model can accept, not which input is useful or free. To connect current API rates to that distinction, the table below shows what the same 100,000 unnecessary input tokens would add to one uncached request. This is an illustrative fixed quantity, not an estimate of how much noise a typical request contains. Rates were checked against provider documentation on September 9, 2026.
Table 2: The cost when irrelevant information is billed as input, for popular AI models.
| Model | Advertised context and output | Standard input/output price | Cost of 100K unnecessary input tokens | Important caveat |
|---|---|---|---|---|
| OpenAI GPT-5.6 Sol | 1,050,000-token context; 128,000 max output | $4 / $20 | $0.40 at the standard rate; $0.80 when the request exceeds 272K input tokens and the 2× rate applies to the full request | Current $4/$20 pricing is promotional through at least Nov 21, 2026. |
| Google Gemini 3.8 Flash | 1M-token context; 64K max output | $0.75 / $3.75 introductory | $0.075 | Introductory pricing is time-limited; check the pricing page before deployment. |
| Anthropic Claude Sonnet 5 | 1M-token context; 128K max output | $2 / $10 | $0.20 | Its tokenizer produces different token counts from earlier Sonnet models, so existing budgets should be recalculated. |
In each case, 100,000 irrelevant tokens would also consume about one-tenth of the advertised window without adding task-relevant evidence. The exact dollar cost varies by model, caching, pricing tier, and tokenizer, but the design implication is the same: a 1M-token ceiling makes noisy input possible to submit; it does not make that input free or useful. Model selection should therefore consider effective task performance and input quality alongside maximum capacity.
How can you manage context without losing important information?
Context management controls what enters the window, what remains active, and what is preserved outside it. For a foundational explainer, four principles cover the main decisions:
1. Keep only information required for the current objective
Define the expected output, decision, schema, or completion condition before retrieving material. Start with the smallest likely source set and add evidence when a remaining question requires it. This gives retrieval systems a clearer basis for deciding which files, pages, and previous messages belong in the active context.
2. Summarize completed work before starting a new phase
Compaction should retain accepted decisions, unresolved problems, key evidence, changed files, and the next action. It should remove superseded plans, repeated tool output, and failed attempts that no longer affect the result. Test summaries on representative workflows because excessive compression can erase subtle dependencies.
3. Store durable decisions outside the active conversation
Use a handoff file, database, or memory system for information that must survive multiple sessions. External storage should preserve the source and status of important decisions instead of forcing every later model call to carry the complete interaction history.
4. Isolate bounded tasks when their intermediate work is unnecessary
A subagent or specialized system can perform a contained task and return its conclusion, evidence, source locations, uncertainties, and recommended next action. This helps only when the main model receives a concise, decision-relevant result rather than the delegated system's entire trace.
These principles should be evaluated with production-shaped inputs. Measure completion accuracy, retrieval quality, latency, token use, and cost at realistic context lengths and densities. A model's advertised limit cannot determine the best context design for a specific application.
For a deeper treatment of retrieval, compaction, handoff files, and long-running agent workflows, see better context, not more context.
How does web data affect an agent's context window?
Web-grounded workflows introduce an additional source of context pressure: webpage content often enters the host model's context directly. A page can contain navigation, cookie banners, advertisements, related stories, widgets, repeated links, and error messages alongside the requested information.
The web layer therefore affects the proportion of useful evidence passed to the reasoning model. TinyFish can address this input boundary at three points in a web workflow:
- TinyFish Search returns ranked web results with titles, URLs, snippets, site names, and positions, helping applications select pages before fetching full content.
- TinyFish Fetch renders selected URLs and returns Markdown, HTML, or JSON while removing page chrome and other low-value elements.
- TinyFish Web Agent, powered by Mako, handles intermediate navigation outside the host model’s context window and returns the finished result.
Applications can protect the active context by selecting only the pages required for the task, extracting the main content rather than full page chrome, requesting only the necessary fields, and reading long sources in stages. These controls extend the same vendor-neutral context-management principles described above to web data.
TinyFish Fetch, particularly, renders a selected URL and returns Markdown, HTML, or JSON while filtering page chrome and other low-value elements. In TinyFish's 45-URL Fetch quality evaluation, the company reported usable results for 42 URLs, or 93% coverage, and a 90.5% median signal ratio among usable results. These product-run metrics measure extraction usability and the share of output classified as useful signal; they do not independently establish more accurate LLM answers or lower total token use in every workflow. Cleaner output can reduce the irrelevant webpage content passed into a model, creating better conditions for downstream reasoning.

CREAO: budgeting web content against model capacity

CREAO builds an AI agent platform whose agents need access to public webpages, scholarly search, and recent news. It made TinyFish Search and Fetch its default web layer rather than requiring each agent builder to implement web reading independently.
Instead of applying one fixed content limit, CREAO sizes each Fetch result against the active model's available context and divides that budget across URLs in a batch. When a document does not fit in one response, continuation reads retrieve the next section from the same version of the page.
After TinyFish became the default, CREAO reported that web-reading usage grew from approximately 70 daily scrapes to 700–800 calls across 1,200–1,600 URLs while request success remained nearly unchanged. The important context-window lesson is not the increase in usage itself, but the design pattern: each model call receives only the web content it can use effectively, while remaining evidence stays available for staged retrieval.
Conclusion
The practical value of an LLM context window depends on how much task-relevant signal occupies the active context. Irrelevant, duplicated, and obsolete tokens still consume capacity, increase input costs, and make necessary evidence harder to retrieve.
The optimization target is therefore task-relevant signal per unit of active context, not maximum window size. Choose a window that can hold the evidence the workload requires, then improve what enters it: remove noise, preserve useful structure, and retrieve additional information only when the task needs it. For web-grounded applications, that also means evaluating how cleanly the web layer selects and returns evidence.
Try TinyFish Search and Fetch to return cleaner web evidence to your AI applications and agents.
FAQs
What model has the largest LLM context window?
The answer changes as providers release new models and depends on whether you compare research claims, self-hosted models, or production API endpoints. Meta advertises a 10-million-token window for Llama 4 Scout, while the hosted models sampled above provide approximately 1 million tokens. Verify the exact deployment endpoint because support can differ across platforms.
Do bigger context windows cost more?
Providers usually charge for the tokens processed rather than unused capacity. However, sending more input generally raises cost, and some providers apply higher rates after a long-context threshold. A model with a larger advertised window is not necessarily more expensive if the application sends the same number of tokens.
How can developers reduce context-window usage?
Retrieve only the sources needed for the current objective, remove repeated tool output, summarize completed work, isolate bounded tasks, and store durable decisions externally. Validate the result after compression because reducing token count is not useful if necessary evidence is lost.
Does web content consume an LLM's context window?
Yes. Webpage text returned to the model counts as input. Cleaner Fetch output can reduce navigation, advertisements, boilerplate, and other irrelevant elements before they compete with the requested evidence.
Can a model use every token in its advertised context window as source input?
Not always. The provider may separately limit output, and instructions, conversation history, tool results, and reasoning tokens where applicable also occupy capacity. Check both the total context window and any separate input or output limits before allocating a request.
AI disclosure
Content on this website may be created or refined with the assistance of AI tools and is subject to human editorial review.



![The 6 Best AI Web Scraping Tools in 2026 [Real Ratings & Reviews]](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fnhc04xln%2Fproduction%2F98cb466165568a842651cc76b68098e8a2b26c26-1920x1080.png%3Frect%3D7%2C0%2C1906%2C1080%26w%3D600%26h%3D340&w=3840&q=75)