What is a context window in AI? How it works, limits, resets, and how long 128K or 1M is

What context windows are and how they work, input limits, why they are limited and matter, whether they are per chat, Claude resets, and what 128K or 1M holds.

In a packed college auditorium
In a packed college auditorium

Key takeaways

  • A context window is the maximum amount of text, measured in tokens, a model can consider at once, including its output.
  • Long context windows of hundreds of thousands to a million tokens let models read large documents or codebases.
  • Limits exist because attention computation and memory grow with length, raising cost and latency.
  • Context is per conversation; new chats start fresh, and tools like Claude Code summarise or compact long sessions.
  • Roughly, 128K tokens is about 96,000 English words and 1M tokens about 750,000 words.

A context window is the maximum amount of text, measured in tokens, that a language model can take into account at once: your instructions, the conversation so far, any documents, and the response it generates. Long context windows, from hundreds of thousands to a million tokens, let models read whole reports, books or codebases in one go. Context management is central to RAG systems like RAG.NextUpgrad, so this page explains how context windows work, their limits, why they matter, resets in Claude, and what different sizes hold.

What is a long context window in AI?

A long context window is a model's ability to handle very large inputs, commonly 128,000 tokens and above, with some models supporting around a million tokens. That is enough to include long contracts, multiple research papers or substantial codebases in a single request.

Also asked as: what is long context window in ai

Long context enables tasks such as summarising whole books, answering questions across many documents, analysing large logs and reviewing code across files. It does not mean the model uses every part equally well: research found models can miss information placed in the middle of long inputs. For large knowledge bases, retrieval still helps by selecting the most relevant parts. A good rule: use long context when the task genuinely needs the whole document, and retrieval when only a few passages matter.

How does a context window work?

Text is split into tokens, pieces of words, and the model processes all tokens in its window together using attention, which lets each token consider the others. Everything outside the window is invisible to the model for that request.

Also asked as: how does context window work

In chat apps, the window holds the system prompt, conversation history, uploaded content and the new answer. As conversations grow, older parts may be summarised, truncated or dropped to stay within the limit. Each request is processed fresh: the model has no memory beyond what is placed in the window, plus any separate memory features that add saved information to the context.

What is a context window limit?

The context window limit is the maximum number of tokens a model accepts per request, combining input and output. Exceeding it causes errors in APIs, or truncation and summarisation in chat apps. Output usually has its own, smaller maximum.

Also asked as: what is context window limit

Limits vary by model and plan, from a few thousand tokens in older models to hundreds of thousands or a million in recent ones. Practical limits are often lower than technical ones because of cost, latency and quality. In applications, budget tokens deliberately: system prompt, retrieved chunks, conversation history and space for the answer, trimming whichever matters least.

What is the input context window?

The input context is the portion of the window filled by what you send: system instructions, conversation history, documents, retrieved passages and the current question. The remaining space is available for the model's output.

Also asked as: what is input context window

Input tokens are typically cheaper than output tokens in API pricing, but large inputs still add cost and latency, especially when resent with every turn. Prompt caching reduces cost for repeated, stable input such as long system prompts or documents. Designing inputs carefully, putting the most important instructions and content clearly, improves both quality and cost.

Why is the context window limited?

Context windows are limited because the attention computation and the memory for storing intermediate values grow with input length, increasing compute cost, GPU memory needs and latency. Models also need training on long sequences to use them well.

Also asked as: why context window is limited

Engineering advances, such as efficient attention kernels, better memory management and training techniques, have extended windows dramatically. But longer context still costs more per request and can reduce precision on details. That is why many systems combine moderate context with retrieval: select relevant passages rather than sending everything.

Why does the context window matter?

It determines how much information a model can use at once: long documents, extended conversations, many retrieved passages or large codebases. Too small a window forces aggressive trimming, losing details; a large window enables richer tasks but costs more.

Also asked as: why does context window matter

For developers, context shapes architecture: whether to send whole documents or retrieve chunks, how to manage chat history, and how agents keep track of long tasks. For users, it explains why long chats start "forgetting" early details. Good context management, keeping what matters and dropping what does not, often improves results more than a bigger window. Agents in particular need careful context handling, since tool outputs accumulate quickly over many steps.

Is the context window per chat?

Yes. Each conversation has its own context; starting a new chat begins with an empty window, apart from system instructions and any saved memory or project files the app adds. Within a chat, the window holds as much of the conversation as fits.

Also asked as: is context window per chat

Features such as projects, custom instructions and memory carry selected information across chats by inserting it into each new context. Through APIs, applications decide exactly what context to send each time. If a chat becomes long and unfocused, starting a new one with a short summary of key points usually gives better answers.

When does the context window reset in Claude?

In the Claude apps, each new conversation starts with a fresh context window. Within long conversations, the app manages context as it grows, and you may be prompted to start a new chat. In Claude Code, long sessions are automatically compacted, summarising earlier history to free space, and you can clear or compact manually.

Also asked as: when does context window reset claude

Practical tips: start new chats for new topics, use projects to keep shared files and instructions available across chats, and in Claude Code use project memory files such as CLAUDE.md for durable instructions. Similar mechanisms exist in other tools, such as automatic summarisation in coding agents.

How long is a 128K context window?

A 128K context window holds about 128,000 tokens, roughly 96,000 English words using the common estimate of about three-quarters of a word per token, equivalent to a few hundred pages of text, such as a long novel or a large technical report.

Also asked as: how long is 128k context window

For comparison, 32K tokens is about 24,000 words, roughly a long article series or a short book section, and 200K tokens is about 150,000 words. Code and non-English text use tokens differently, often more tokens per word for Indian languages, so actual capacity varies. Use a tokenizer tool to measure your own documents.

How long is a 1M context window?

A one million token context window holds roughly 750,000 English words, the equivalent of several long novels, thousands of pages of documents, or a large codebase, in a single request.

Also asked as: how long is 1m context window

Such windows enable tasks like analysing entire code repositories, many hours of transcripts or large document collections at once. Requests this large are slower and more expensive, and models may not use all details equally well. For repeated questions over the same large corpus, retrieval or caching usually beats sending a million tokens each time.

Sources

  1. Anthropic Docs, Context windowsdocs.anthropic.com
  2. Vaswani et al., Attention Is All You Need (2017)arxiv.org
  3. Liu et al., Lost in the Middle: How Language Models Use Long Contexts (2023)arxiv.org
  4. OpenAI, Tokenizerplatform.openai.com
  5. Google AI for Developers, Long contextai.google.dev
Pranjul Rathour
Pranjul Rathour
GenAI Engineer · India

GenAI engineer and AI product builder with 2+ years shipping production-grade AI systems: RAG pipelines, fine-tuned LLMs, hybrid retrieval and multi-modal apps across vision, speech and OCR, architected end to end from ingestion to deployment. Leads engineering for SCULT INDIA's 14-member team, founded the 500+ member TechVerse Enclave community and has mentored 200+ students. Three hackathon first prizes: Changethon 2025 (IIT Roorkee), Product Genesis at Vividhotsava 2025 (CSJMU) and BYTEBATTLE (MeetKats).

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way. Email pranjulrathour41@gmail.com.

Keep reading

More on RAG & retrieval

All RAG & retrieval guides →
Campus talks · hackathon judging · mentoring

Want this as a live session at your college?

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way.

Pranjul Rathour, GenAI engineer in India