What is a context window in a language model?
ExplainerBy Lucas Matías García TorresUpdated (first published )Data checked 5 min read
Reviewed by Lucas Matías García Torres on . How we work.

Short answer
A context window is the amount of text, counted in tokens, that a model can consider in one request: your prompt, the conversation so far, documents, tool definitions and its own answer. In October 2026, current Claude models list 1M tokens, GPT-6.1 Sol lists 1,050,000 and Gemini lists 1 million or more, while ChatGPT's app windows run from 27K to 400K by plan. Bigger is not automatically better: vendors say accuracy can fall as the window fills.
Prices and limits change often: check the vendor's page before you pay. How we make money.
A context window is the amount of text, measured in tokens, that a language model can take into account at one time: your prompt, the conversation so far, any documents or tool definitions you send, and the answer it is writing. Google's documentation compares it to short-term memory. This guide explains what a context window is in a language model, how large the windows of the main models are as of October 6, 2026, what happens when you fill one, and why a bigger window is not automatically better. If the word "token" is new, start with what a token is.
What is a context window?
Anthropic defines the context window as "all the text a language model can reference when generating a response, including the response itself". It is different from the large body of data the model was trained on: it is the "working memory" of one conversation or request. The model does not remember anything outside it unless a product adds its own memory feature.
Everything in the request counts toward the window. For the Claude API that means the system prompt, every message including tool results, images and documents, the definitions of the tools you offer and the output Claude generates, including its extended thinking. Cached prompt prefixes also count: prompt caching changes what you pay for them, not whether they occupy space.
How big are context windows in 2026?
Table: context windows of popular models and products (October 6, 2026)
| Model or product | Context window | Source |
|---|---|---|
| Claude Opus 5.5, Sonnet 5.5, Fable 5.1 (API) | 1M tokens, up to 128K output tokens per request | Anthropic docs |
| Other Claude models, such as Sonnet 4.5 | 200K tokens | Anthropic docs |
| GPT-6.1 Sol (API) | 1,050,000 tokens, up to 128,000 output tokens | OpenAI model page |
| Gemini models (API) | "1 million or more tokens" | Google docs |
| ChatGPT app, fast model | 27K (Free), 54K (Go, Plus), 128K (Pro) | ChatGPT pricing page |
| ChatGPT app, reasoning models | 256K (Go, Plus), 400K (Pro) | ChatGPT pricing page |
| Claude apps | "Up to 1M, varies by model" on Free, Pro and Max | Claude pricing page |
The same company can show different numbers for its API and its app, so check which product you are using. Anthropic notes that chat interfaces such as Claude's web app can also manage the window on a rolling "first in, first out" basis, which means the oldest parts of a long chat may drop out. Google puts 1 million tokens in perspective: about 50,000 lines of code at 80 characters per line, eight average-length English novels or more than 200 podcast transcripts.
What happens when you fill the window?
It depends on the product. In the Claude API, if the input alone is larger than the window the request fails with a 400 error ("prompt is too long"). On newer models, if the input plus the maximum output you allow goes beyond the window, the API accepts the request and, if the answer hits the limit, stops with the reason model_context_window_exceeded. In chat apps, older messages may be dropped or summarized so the conversation can continue.
To manage this, Anthropic offers server-side compaction, which summarizes earlier parts of a conversation on the server (in beta for Claude 4.6 and later models), and context editing, which clears old tool results or thinking blocks. You can measure a request before you send it with the token counting API.
Does a bigger context window mean better answers?
No, and the vendors say so. Anthropic writes that "more context isn't automatically better": as the token count grows, accuracy and recall degrade, a phenomenon it calls context rot. Google's long-context guide recommends putting your question at the end of the prompt, after all the other context, and warns that when you look for several specific facts in a huge input, the model "does not perform with the same accuracy".
In practice, a larger window lets you paste a whole report or code base, but you should still curate what goes in. Sending only the relevant pages is usually cheaper and often more reliable than sending everything.
How much does a long context cost?
You pay for every input token, so a full window costs more than a short prompt. The pricing rules differ by vendor. For Claude models with a 1M window, Anthropic says the full window is billed at standard rates: a 900K-token request costs the same per token as a 9K-token request. OpenAI states that for GPT-6.1 Sol, requests over 272K input tokens pay 2x on input and cached input and 1.5x on output for the whole request. Google recommends context caching to cut the cost of repeated context. Our LLM API pricing guide and calculator show the effect of caching and batch discounts on a real workload.
Context windows on your own computer
When you run a model locally, the context window is limited by memory. The model keeps a key-value cache that grows in a straight line with the number of tokens: for Llama 3.1 8B at 16-bit precision, our calculation (checked against the published model configuration) gives 1 GiB at 8,192 tokens, 4 GiB at 32,768 and 16 GiB at its full 131,072 tokens. The details are in how much VRAM an LLM needs.
Ollama sets a default context length by the memory you have: 4K tokens below 24 GiB of VRAM, 32K between 24 and 48 GiB and 256K at 48 GiB or more. You can change it with the slider in the app or with OLLAMA_CONTEXT_LENGTH=64000 ollama serve, and Ollama recommends at least 64,000 tokens for tools such as web search and coding tools. After you raise it, run ollama ps and check that the model still shows "100% GPU", which means nothing was pushed onto the processor.
How to work with a limited context window
- Keep the useful part: paste the relevant section, not the whole file.
- Put the question last: Google advises placing the query after the context.
- Start a new chat for a new task: old, unrelated messages still take up space.
- Summarize long threads: ask the model for a summary and continue from it, or use a product's compaction feature.
- Cache repeated context: both Anthropic and Google document caching to lower cost.
- Bring in documents on demand: for large knowledge bases, the usual answer is a system that retrieves only the passages needed for each question (retrieval-augmented generation), and agents do something similar by calling tools to fetch what they need.
What the context window is not
It is not the model's training data, and it is not permanent memory. It is not the same as the maximum output length either: Claude's 1M models can produce up to 128K tokens in a single response, a much smaller number. And it is not a quality guarantee: a model can accept a million tokens and still miss a detail buried in the middle.
What we checked
- Anthropic defines the context window as all the text a model can reference when generating a response, including the response itself, a working memory distinct from training data; everything in the request counts, including system prompt, messages, tool results, images, documents, tool definitions and thinking tokens; cached prefixes still occupy the window. (Anthropic, )
- Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and other listed current models have a 1M-token context window with up to 128K output tokens per request; other models such as Sonnet 4.5 have 200K; 1M is the default and long-context requests are billed at standard pricing. (Anthropic, )
- As token count grows, accuracy and recall degrade (context rot); more context is not automatically better; chat interfaces such as Claude's web app can manage the window on a rolling first-in, first-out basis. (Anthropic, )
- Input larger than the window returns a 400 prompt-is-too-long error; on Claude 4.5 models and newer, input plus max_tokens beyond the window is accepted and generation that reaches the limit stops with model_context_window_exceeded; server-side compaction is in beta for Claude 4.6 and later models; context editing clears old tool results and thinking blocks; a token counting API estimates requests. (Anthropic, )
- A 900k-token Claude request is billed at the same per-token rate as a 9k-token request on models with the 1M window. (Anthropic, )
- GPT-6.1 Sol has a 1,050,000-token context window and 128,000 max output tokens; requests above 272K input tokens pay 2x on input and cached input and 1.5x on output for the whole request. (OpenAI, )
- In the ChatGPT app, the GPT Instant total context window is 27K (Free), 54K (Go, Plus) and 128K (Pro); the GPT Reasoning window is 256K (Go, Plus) and 400K (Pro). (OpenAI, )
- Claude's plan page lists a context window of up to 1M, varying by model, on Free, Pro and Max. (Anthropic, )
- Google's documentation compares the context window to short-term memory, says Gemini models have context windows of 1 million or more tokens, gives 1 million tokens as about 50,000 lines of code or eight average novels, advises putting the query at the end of the prompt, warns about lower accuracy when looking for several specific facts and recommends context caching to cut cost. (Google (Gemini API docs), )
- Ollama defaults to a 4K context below 24 GiB of VRAM, 32K between 24 and 48 GiB and 256K at 48 GiB or more; it can be changed in the app or with OLLAMA_CONTEXT_LENGTH=64000 ollama serve; at least 64,000 tokens are recommended for web search and coding tools; ollama ps shows whether the model runs 100% on the GPU. (Ollama, )
- Llama 3.1 8B has 32 layers, 8 KV heads and a head dimension of 128, which gives a 16-bit key-value cache of 1 GiB at 8,192 tokens, 4 GiB at 32,768 and 16 GiB at 131,072 (our calculation). (unsloth (Hugging Face), )
What may change
- Context window sizes and model names change every few months; this page is reviewed quarterly.
- Plan pages and API pages can disagree for the same company; check which product you use.
- Compaction and context editing are beta features and may change.
Frequently asked questions
What is a context window in simple terms?
It is the amount of text, counted in tokens, that a model can consider in one request: your prompt, the conversation so far, any documents and the answer it writes. Google compares it to short-term memory. Anything outside the window is not available to the model unless a product adds its own memory.
What is the context window of Claude?
Anthropic lists a 1M-token window for Claude Opus 5.5, Sonnet 5.5 and Fable 5.1 on the API, with up to 128K output tokens per request, and 200K for older models such as Sonnet 4.5. Claude's plan page lists up to 1M, varying by model, on the Free, Pro and Max plans.
What is the context window of ChatGPT?
In the ChatGPT app, OpenAI lists 27K tokens for the fast model on Free, 54K on Go and Plus and 128K on Pro, and 256K to 400K for reasoning models on Go, Plus and Pro. The GPT-6.1 Sol API model has a 1,050,000-token window with up to 128,000 output tokens.
Does a bigger context window mean better answers?
Not automatically. Anthropic says accuracy and recall degrade as the token count grows, which it calls context rot, and Google says a model may not find several specific facts in a huge input with the same accuracy. Sending only the relevant material is usually cheaper and more reliable.
What happens when the context window is full?
In the Claude API, an input larger than the window returns a 400 error, and on newer models an answer that reaches the limit stops with the reason model_context_window_exceeded. Chat apps may drop older messages. Compaction, which summarizes earlier turns, and starting a new chat both help.
How much memory does a long context need on my own computer?
The key-value cache grows in a straight line with context. For Llama 3.1 8B at 16-bit precision, our calculation gives 1 GiB at 8,192 tokens, 4 GiB at 32,768 and 16 GiB at 131,072. Ollama defaults to 4K tokens below 24 GiB of VRAM, and you can raise it with OLLAMA_CONTEXT_LENGTH.
Sources
- Context windows (Claude API): sizes by model and thinking tokens, Anthropic. Accessed October 6, 2026.
- Claude API pricing: models, prompt caching, batch, long context and tokenizer note, Anthropic. Accessed October 6, 2026.
- GPT-6.1 Sol model page: context window, cached input and long-context pricing, OpenAI. Accessed October 6, 2026.
- ChatGPT pricing: plans, models, context windows and features, OpenAI. Accessed October 6, 2026.
- Claude plans and pricing (Free, Pro, Max, Team, Enterprise), Anthropic. Accessed October 6, 2026.
- Long context (Gemini API): what a context window is and how to use it, Google (Gemini API docs). Accessed October 6, 2026.
- Ollama: context length defaults and settings, Ollama. Accessed October 6, 2026.
- Llama 3.1 8B Instruct config.json (unsloth mirror of Meta's weights), unsloth (Hugging Face). Accessed October 1, 2026.
Spotted an error or an outdated price? Tell us and we will fix it.
Change history
- : Fixed a typo ("OpenAI model"); no figure, date or source changed.
- : Wording revised; no figure, date or source changed.
- : First published from Anthropic, OpenAI, Google and Ollama documentation.
Next review: .
Part of our Language Models Explained guide.
Keep reading
- What is a token in a language model?
What a token is in a language model, how many words it equals, why Spanish and French need more tokens than English (we measured it) and how they are billed.
- LLM API pricing compared, with a cost calculator
API prices for OpenAI, Anthropic, Google and DeepSeek models per million tokens, plus a calculator with caching, batch discounts and tokenizer differences.
- How much VRAM do you need to run an LLM locally?
Work out how much GPU memory a local LLM needs from its size, quantization and context length. Our formula is checked against 13 real model files.
- What is an agent?
What an agent is, how it differs from a chatbot or a workflow, how the plan-act-observe loop works, real examples, when you do not need one and the risks.
- Claude pricing: what each plan costs and what you get
Claude pricing in October 2026: what Free, Pro, Max, Team and Enterprise cost, what each plan includes, how usage limits work and when the API is cheaper.
Other topics

Assistants & Chatbots
16 guides

LLM APIs & Costs
11 guides

Agents & Automation
8 guides

Local Models & Hardware
11 guides