Tokens and the context window. What they are and what takes up space before you type

What a token is, what an AI model's context window is, what fills it and what happens when it is full, in a chat, in the API and in Claude Code.

In this article
  1. What is a token
  2. The context window is the model's working memory
  3. What fills the context window
  4. What happens when the window is full
  5. Context window and your limit

In short

A token is a piece of text in which a model counts everything it reads and writes, and the context window is its working memory, all the text it has in front of it for one answer. The window holds the system instructions, files, tool results, the whole conversation and the answer itself. Current Claude models have a window of 1 million tokens, and Claude Code summarises the conversation before it fills up.

Someone pastes three contracts into a chat, asks about one date, and a few messages later the model mixes the contracts up and the limit runs out. Two ideas explain most cases like this, the token and the context window. Below we explain what they are without formulas.

We have separate articles on why long conversations go wrong and how to save your limit. Here we stay with the ideas themselves and with what happens when the window fills up. This article is part of our Claude Code guide, as of 10 November 2026.

What is a token

A model does not read letters or words. Before text goes to the model, it is split into tokens. According to Anthropic's glossary, a token can be a word, part of a word, a single character or even a byte. Short common words are often one token, long and rare ones split into several.

How many characters a token covers depends on the model and the language. Anthropic says that on older Claude models a token is on average about 3.5 characters of English text. Models from Claude Opus 4.7 onward use a newer tokenizer that turns the same text into roughly 30 percent more tokens. The exact count for a given model comes from the token counting feature in the API.

Almost everything is measured in tokens. How long a conversation the model can handle, the limits in the app, and in the API the bill. A short definition is in our AI glossary.

The context window is the model's working memory

The context window is all the text the model can refer to while writing an answer, including the answer itself. Anthropic calls it the model's working memory and separates it from the data the model was trained on. Training gives general knowledge. The window is what the model has in front of it right now.

The model does not remember the conversation between messages. For every answer it gets the whole conversation so far again, and its answer becomes part of what it will get next time. That is why the window grows with every exchange.

Window sizes are in the Claude documentation. Current Claude models, from the strongest to the lightest, have a window of 1 million tokens. Older models, for example Claude Sonnet 4.5, have 200 thousand. According to the models overview, 1 million tokens on the new tokenizer is roughly 555 thousand English words.

What fills the context window

More goes into the window than you see on screen. The documentation lists the system prompt, every message together with tool results, images and documents, the descriptions of available tools, and finally the model's answer, including its thinking.

In Claude Code part of the window is taken before you type anything. At startup it loads CLAUDE.md or AGENTS.md, auto memory, tool names from MCP servers and short skill descriptions. After that every file read and every command result adds more. The documentation warns that one big file or a command with long output can use thousands of tokens in a single step.

The /context command shows what takes up space in your session. It splits the used space into categories and suggests what to trim. Two things help up front. A skill's full content loads only when the skill is used. A subagent reads files in its own window and returns only a summary to the conversation, which we cover in the article on Claude Code subagents.

What happens when the window is full

It depends where you are. In the API, if the request alone is longer than the window, Anthropic returns an error saying prompt is too long. The Claude app can move the window so that the oldest messages drop out first.

Claude Code does not end the session when the window is full. As it gets close to the limit, it summarises the conversation, which is called compaction. The summary keeps your requests and key code snippets, but detailed instructions from early in the conversation can get lost.

After compaction some things come back on their own. The project root CLAUDE.md and auto memory are reloaded from disk, and Claude Code re-reads up to five files it recently read or edited. What was said only in the conversation survives only in the summary. You type these commands where you type a normal message.

Claude Code
# what fills the window right now
/context

# a summary that keeps what you name
/compact focus on the order form changes

# compact earlier, at the token count you set
/autocompact 500k

# a new conversation with an empty window
/clear

Rules that must survive a summary belong in CLAUDE.md, not in the conversation. How to write it is covered in our CLAUDE.md article, and all slash commands in the article on slash commands.

Context window and your limit

A bigger window does not mean you should fill it. Anthropic's documentation says plainly that as the token count grows, accuracy and recall of details get worse. What that means for long conversations is covered in why ChatGPT forgets in long conversations.

The window also means a limit or a bill. Since the model gets the whole conversation with every message, each message in a long session carries the whole session with it. On paid Claude plans that eats your limit, in the API it costs money. What else eats the limit is covered in why the Claude usage limit runs out fast.

When you change topic, start a new conversation, and in Claude Code type /clear. The window is large, but the model works best when it holds only what the task needs.

If you want to know where AI can take work off your company, ask for our free AI audit. We look at your tasks and tell you where to start.

What would you like to change in your business?

Leave your number. We will talk about your process and see whether we can help. The first call is free.

When is the best time to call?
Controller: Oleksandr Bondarenko (BondSoft)Privacy PolicyTerms of Service
Legal details

The data controller is Oleksandr Bondarenko, trading as Oleksandr Bondarenko Software Solutions (BondSoft), ul. Jana Heweliusza 11, 80-890 Gdańsk, Poland, NIP 5833576264, e-mail: office@bondsoft.pl.

We process your data solely to contact you about your enquiry and to present an offer — on the basis of your consent (Art. 6(1)(a) GDPR and Art. 398 of the Polish Electronic Communications Law) and our legitimate interest in handling the enquiry (Art. 6(1)(f) GDPR).

Providing the data is voluntary but necessary for us to reply. You may withdraw your consent at any time by writing to office@bondsoft.pl — this does not affect the lawfulness of processing before the withdrawal.

You have the right to access your data, rectify it, erase it, restrict its processing, transfer it, and lodge a complaint with the President of the Polish Personal Data Protection Office.

Full information: Privacy Policy.

Send us an email

The service this text is about

Automation and AI / OCR

Automation of document re-typing, OCR and checking rules, and your data stays with you.