How Do Context Windows Work, and What Are the Token Limits for GPT 5.2, Claude Sonnet 4.5, and Gemini?

Published On: July 22nd, 2026|Categories: AI, Programming|8 min read|

Every language model has a hard ceiling on how much text it can consider at one time, and that ceiling is called the context window. It governs how long a conversation can run, how much code a model can read at once, and where an agent starts to forget. The size of that window varies dramatically between models, and the numbers change often. Understanding what the window is, and what it is not, matters more than memorizing any single figure.

The window is measured in tokens

A context window is the maximum number of tokens a model can take as input at once. Since tokens are chunks of text usually smaller than a word, a window is not a word count or a character count but a token count. A window of two hundred thousand tokens holds roughly a hundred and fifty thousand words, give or take. This is the unit that actually matters, and thinking in tokens rather than pages is the right instinct. The window is a token budget, full stop.

Everything shares the window

The window is not just for your prompt, it has to hold the entire input context plus the model’s reply. That means the system prompt, tool descriptions, memory, conversation history, any documents, your request, and the generated output all draw from the same pool. A long conversation eats into it steadily, which is why very long chats eventually strain the limit. The reply competes for space too, so a huge input can leave little room to answer. Every token you spend on input is a token not available for anything else.

Current limits vary widely

The headline numbers differ by a lot across the major models, as documented in references like the Claude context window docs. GPT-5.2 offers a context window of about four hundred thousand tokens, with output capped separately around a hundred and twenty-eight thousand. Claude Sonnet 4.5 uses a two hundred thousand token window as standard, with a one million token option available in beta for large jobs. Gemini, in its 2.5 Pro form, leads the mainstream field at around two million tokens. These figures shift with each release, so always confirm the current number for the exact model you are using.

Bigger is not automatically better

It is tempting to assume the largest window wins, but that is a trap. Models suffer from a well-known lost-in-the-middle effect, where facts buried in the center of a very long input get less attention and are more easily missed. Broader writing on large language models notes that a huge window does not guarantee reliable recall across all of it. So a two million token window does not mean two million tokens of dependable memory. The advertised size and the effective size are different numbers, and the gap grows as inputs get longer.

Effective context is smaller than advertised

This distinction is worth dwelling on because it shapes real decisions. The effective context is the amount a model can actually use reliably, and it is typically well below the advertised ceiling. Stuffing a window to the brim often produces worse answers than a smaller, focused input, because the signal gets diluted. Treating the limit as a hard maximum to avoid, rather than a target to fill, is the healthier mindset. The window tells you what is possible, not what is wise.

Cost and latency scale with context

Filling a large window is not free in money or time. Because pricing is per token and the model does more work the more it reads, a bigger input costs more and takes longer to process. A prompt that fills a million-token window can be dramatically more expensive and slower than a focused one. This is a direct consequence of how the model reads its whole input before responding. Large windows are a capability to use sparingly, not a resource to max out by default.

Why the limits exist

The window has a ceiling because the computation grows sharply as the input gets longer. Processing attention across a very long context takes disproportionately more resources, which is why bigger windows are hard and expensive to build. The steady march from tiny early windows to millions of tokens reflects real engineering effort, not a simple dial. Understanding this explains why window size is a headline feature that companies compete on. It is a genuine technical achievement, with genuine costs attached.

Use a big window wisely

Having a large window changes what is possible but not what is smart. The skill is to use the space deliberately, filling it with high-signal, relevant content rather than everything you have, which is the heart of context engineering. A big window lets you include a whole codebase or a long document when you truly need to, without forcing you to always. Reaching for the maximum by reflex wastes money and can hurt quality. The window is a tool, and good use of a tool is selective.

When you hit the limit

Every long task eventually bumps against the ceiling, and something has to give. The usual moves are to drop the oldest content, summarize earlier parts into a compact note, or selectively keep only what is relevant, the same management that lets a stateless model hold a long conversation. Handling this gracefully is what keeps a long session coherent instead of confused. The limit is not the end of a task, it is the point where context management takes over. How you handle the ceiling matters more than how high it is.

Why this matters for coding agents

Coding agents hit the window faster than almost anything, because they read files and tool output constantly. An agent working through a real task can fill a large context in a single session, which is why context management is a core agent skill rather than an afterthought. A bigger window buys an agent more room, but it does not remove the need to manage that room. This is why serious agent work pays close attention to what stays in context. The window is the agent’s whole world, and it is always finite.

The takeaway

A context window is the token ceiling on what a model can read at once, and it currently ranges from around four hundred thousand tokens for GPT-5.2 to two hundred thousand for Claude Sonnet 4.5 to about two million for Gemini. But the effective, reliable context is smaller than the advertised number, and filling the window costs money and quality. Know the limits, and use far less of them than you can.

Common questions

What is a context window?

The maximum number of tokens a model can take as input at once. It must hold the whole input, including system prompt, history, and documents, plus the model’s reply.

What are the token limits for GPT-5.2, Claude Sonnet 4.5, and Gemini?

GPT-5.2 is around 400,000 tokens, Claude Sonnet 4.5 is 200,000 with a 1 million beta option, and Gemini 2.5 Pro is about 2 million. These change with each release, so verify the current figure.

Is a bigger context window always better?

No. Models suffer a lost-in-the-middle effect where facts buried in long inputs get missed, so effective context is smaller than advertised. Large windows also cost more and run slower.

Why does a large context cost more?

Pricing is per token and the model does more work the more it reads, so a bigger input is both more expensive and slower to process. Filling a huge window by default wastes money.

What happens when you reach the context limit?

The application drops the oldest content, summarizes earlier parts, or keeps only what is relevant. Handling this gracefully is what keeps a long session coherent.




Related Articles

If you enjoyed reading this, then please explore our other articles below:

More Articles

If you enjoyed reading this, then please explore our other articles below: