Concept beginner · 3 min read

What is Claude context window

Quick answer
The Claude context window refers to the maximum number of tokens the model can process in a single interaction, including both input and output tokens. For claude-3-5-sonnet-20241022, the context window is 100,000 tokens, enabling very long conversations or documents to be handled in one request.
Claude context window is the maximum token length that an Anthropic Claude model can process in a single prompt and response, defining the scope of text it can consider at once.

How it works

The Claude context window is the total token capacity that the model can attend to in one call. Tokens include words, punctuation, and spaces. Think of it as the model's "working memory" size: it can only consider this many tokens from the conversation history and prompt combined when generating a response. For example, a 100,000-token window means Claude can process entire books or long chat histories without losing context.

Concrete example

Using the Anthropic Python SDK, you can interact with claude-3-5-sonnet-20241022 which supports a 100,000-token context window. Here's a minimal example showing how to send a prompt:

python
import os
import anthropic

client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1000,
    system="You are a helpful assistant.",
    messages=[{"role": "user", "content": "Explain the significance of the context window."}]
)

print(response.content[0].text)
output
The context window determines how much text the model can consider at once, enabling it to maintain coherence over long conversations or documents.

When to use it

Use Claude models with large context windows when you need to process or generate very long documents, maintain extensive chat histories, or perform tasks requiring broad context awareness. Avoid smaller context window models if your use case involves lengthy inputs or outputs, as they may truncate important information.

Key Takeaways

  • Claude's context window defines the maximum tokens processed per request, including input and output.
  • The claude-3-5-sonnet-20241022 model supports up to 100,000 tokens, ideal for long-form content.
  • Use large context windows to maintain coherence over extended conversations or documents.
Verified 2026-04 · claude-3-5-sonnet-20241022
Verify ↗