◈AI Codex
Foundation Models & LLMs

Context Window

Also: context length, token limit

The context window is how much text Claude can hold in its attention at once — your conversation history, any documents you've shared, system instructions, and Claude's own responses. Once you hit the limit, older content gets pushed out. Claude Fable 5, Claude Opus 5 and Claude Sonnet 5 each have a 1,000,000-token context window, roughly 555,000 words; Claude Haiku 4.5 has 200,000. Long contexts let Claude analyse full document sets or maintain long conversations — but they also cost more on every turn, and can dilute Claude's focus on the material that actually matters.

◎

In practice

You paste a 200-page document into Claude and it reads the whole thing, using a fraction of the window. You paste an entire document repository and you will eventually find the edge. The practical question stopped being "will it fit" and became "does including this help" — a smaller context holding the right material reliably beats a large one full of noise.

Related concepts

Where Context Window shows up

6 articles

The context window shapes what Claude can and can't do in any given conversation. Here is how to work with it.

Implementation guide·The context window in practice: what it means for how you work →·5 min

Persistent memory for chatbots is not a Claude feature — it is an architecture decision. Here is how to build it correctly.

Implementation guide·Building a Claude chatbot that remembers users across sessions →·8 min

In-memory arrays disappear on page reload. How to persist conversation history to Supabase, load it back on session resume, and prune context intelligently.

Implementation guide·Database-backed conversation history with Supabase and Claude →·8 min

A million tokens sounds like more room than anyone could use. In practice, how you use that space — not whether you run out of it — is what changes the quality of your outputs.

Role-Specific·How to think about Claude's context window (and when it actually matters) →·4 min

Context window is the single number that shapes everything about how Claude thinks with you — and most people are using only a fraction of it.

Core Definition·The whiteboard every AI conversation shares →·5 min

On September 14, 2026 the Messages API gained a `compaction` parameter (beta header `compact-2026-09-04`). You send the conversation, get back one signed summary block, and swap it in for the messages it covers. That makes background compaction and keep-the-last-few-turns compaction possible. Here is the request shape, the swap logic, and the five ways it quietly fails.

update·Compaction on demand: summarizing a conversation when you decide, not when the API does →·12 min