GUIDE

Context windows and tokens: how to work with long documents

Understand the model's working space, leave room for the answer, and organize long inputs so useful details survive.

A context window is the working space a language model can use for a particular response. Tokens measure how content is represented in that space. Neither number tells you, by itself, whether an assistant will answer a question about a long document correctly. Good preparation makes the relevant information easier to locate and check.

Separate capacity from knowledge

Training supplies the model's learned patterns. The current conversation supplies task-specific context. Account memory, saved projects, search, and document retrieval are additional product features; their existence does not mean every stored item is present in every response.

Anthropic's official context guide explains that context includes the material used for a response and the generated output, with tools and other inputs also consuming space. It also distinguishes capacity from effective recall. Exact accounting depends on the service and model, so check the documentation for your chosen interface.

Do not convert words to tokens with a universal ratio

Tokens can represent whole words, fragments, punctuation, or other encoded material. Languages, code, tables, and formatting produce different counts. A rough estimate may help with planning, but it is not a reliable admission check for a specific model.

When using an API, prefer the provider's supported counting method for that model. In a consumer app, inspect any available usage or input-limit information. A page count is only a description of the file: ten dense spreadsheet pages and ten sparse slides can contain very different amounts of information.

Leave space for the output you need

A question about a document needs more than the document itself. Instructions, conversation history, tool results, and the intended answer may all matter. Do not plan an input that uses every available unit and then expect a long report to fit automatically.

As a fictional example, if a system had 100,000 units of shared working capacity and the task required an estimated 10,000-unit answer, preparing a 100,000-unit input would leave no room for that answer. This illustrates budgeting; it is not the limit of a listed product or a promise about its accounting rules.

Organize the task before splitting the document

Begin with the question you want answered. If you need renewal dates, supply the sections defining the contract term, extensions, and exceptions. If you need an overall comparison, include a map of the document so the assistant can identify relevant sections before producing a synthesis.

When you split a long document, preserve headings, source identifiers, and section boundaries. Keep important definitions with the clauses that depend on them. Label each part consistently. Arbitrary chunks can separate a statement from its exception and create an apparently reasonable but incomplete answer.

Use summaries as navigation aids

Create a concise running note containing the goal, established facts, unresolved questions, and original source locations. Use it to restart or continue a long task. Keep the underlying documents available because a summary inevitably leaves details out.

For a comparison across many files, ask for a structured extraction first: one row per source, with the relevant fact and location. Check the rows before asking for the final narrative. This makes missing or conflicting evidence easier to notice than asking for a polished report immediately.

Verify that the crucial details survived

Test the result against known details from different sections, including an exception or qualifier. If the answer omits something important, narrow the question and resupply the relevant material. Increasing capacity is not the only remedy; better source selection may be more useful.

Record the model or interface, date, file set, and method when the task needs to be reproducible. Keep numeric window sizes on a separately maintained product reference. This guide focuses on a workflow that remains useful when those numbers change.

Original sourceRead the official source
EXPLORE THE TOOLClaudeOfficial links, access notes, and plans