# What is a context window?

Everything a model can see at once while it writes an answer, counted in tokens. When the window is full, something has to be left out.

- Page: https://tecyfy.com/concepts/context-window
- Subject: How AI works (https://tecyfy.com/concepts)
- Level: beginner
- Also called: Context Length
- The lesson: Inside an AI agent: what happens after you press Enter (https://tecyfy.com/learn/ai-agents/inside-an-ai-agent)
- Last checked: 2026-10-14

A model has no memory of you between messages. Each time it answers, it reads one long piece of text from the top: the instructions from whoever built the app, the conversation so far, any files you attached, and the results of any tools it used. That piece of text is the context, and the most it can hold is the context window.

The window is measured in [tokens](https://tecyfy.com/concepts/token), the pieces of words a model reads. For Claude a token is about 3.5 characters of English, so 1,000 tokens is about 3,500 characters, a page or two of a paperback. The largest Claude models hold 1 million tokens. Other makers publish their own limits on their model pages.

## What happens when it fills up

Something has to go. A chat app may quietly drop or summarise the oldest messages, which is why a long conversation can "forget" a detail you gave it at the start. An agent that works for a long time does this on purpose. Compaction replaces older turns with a summary. Context editing clears out old tool results that are no longer needed. What must last goes outside the window, into files or a memory tool the model can read back later.

## Bigger is not automatically better

A model does not read a full window as well as a short one. As the token count grows, accuracy and recall get worse. Anthropic calls this context rot. A long document can hold the answer and the model can still miss it, so a short, relevant context usually beats a long, complete one.

## Why it shows up on your bill

Every turn sends the whole context again. Anthropic's example is a task that grows from 20,000 to 120,000 tokens over 40 turns: the conversation never passes 120,000, but the bill counts about 2.8 million input tokens. Caching makes the repeated part cheaper to read. It does not make the window any less full.

## What to do with this

Start a new chat when you change subject. Paste the part of a document that matters, not the whole folder. And when an answer ignores something you said long ago, assume it fell out of view before you assume the model is careless.

## Related

- [Token](https://tecyfy.com/concepts/token): The small piece of text a language model reads and writes, often part of a word. Prices, limits and the context window are all counted in tokens.
- [KV Cache](https://tecyfy.com/concepts/kv-cache): Work a model saves from the text it has already read, so it is not redone for every new token. Prompt caching keeps that work between requests and charges less for it.
- [Agent Memory](https://tecyfy.com/concepts/agent-memory): The ways an agent keeps what it needs beyond a single context window, such as summaries, notes in files, and saved facts it reads back later. The model itself remembers nothing.
- [RAG](https://tecyfy.com/concepts/rag): A way to answer from your own documents. A search finds the passages that match the question, and they are added to the prompt before the model writes.

## Sources

- [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows), Anthropic, Claude API documentation, 2026-09-25. The context window is the model's working memory, and the question, instructions, tool definitions and tool results all count toward it. The largest Claude models hold 1 million tokens. As the token count grows, accuracy and recall get worse, which is called context rot. Compaction summarises older turns and context editing clears old tool results.
- [Glossary](https://platform.claude.com/docs/en/about-claude/glossary), Anthropic, Claude API documentation, 2026-09-25. A language model generates text one token at a time, and a token is about 3.5 characters for Claude.
- [What a task costs on Opus 5.5](https://claude.com/blog/what-a-task-costs-on-opus-5-5), Anthropic, 2026-09-25. A task that grows from 20,000 to 120,000 tokens over 40 turns processes about 2.8 million input tokens, though the conversation never grows past 120,000. Each turn sends the conversation so far.
- [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching), Anthropic, Claude API documentation, 2026-09-25. Text the model has already processed can be read again at a much lower price.
- [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool), Anthropic, Claude API documentation, 2026-09-25. What must last is stored outside the context window, in files the model can read back in a later conversation.
