Topic 3 of 4 · 4 min read
File size, page and token limits for documents
Goal: Plan how to split a document that exceeds page, size or token limits without losing context that spans pages.
Check a document against four limits before you send it, and split on natural boundaries when it does not fit. The four are request size, page count, image count and the context window. Whichever you hit first is the one that fails.
Check yourself · 1 of 3
A PDF is under the page cap but the request still fails with a context error. What is the most likely cause?
Why it matters
Limit errors look like model errors. A 500-page report may pass your upload step and still fail because a request carries too many pages or too many tokens. Planning the split up front is cheaper than debugging it after.
The numbers (Claude, from its docs)
- Request size: 128 MB on the first-party Claude API; other platforms differ.
- Pages per request: 600, or 100 when the request's context window is under 1M tokens.
- Images per request: up to 600, or 100 for models with a 200k-token context window. Above 20 images a stricter per-image size limit applies: keep each side under 3,000 px.
- Files API: 500 MB per file.
- PDF token cost: each page typically uses 1,500 to 3,000 text tokens, plus up to 1,568 visual tokens for the page image.
Other providers differ. OpenAI's guide says each file must be under 50 MB and the combined limit per request is 50 MB. Always read the limits of the provider and model you call, and use token counting to measure a real file.
How to plan a split
- Measure. Count pages and run the provider's token counter on a sample.
- Compare to the smallest limit. Pages, bytes and context window each give a maximum chunk. Use the smallest.
- Split on structure. Cut at chapters, sections or invoices, not at page 50. A table split across two requests loses its header.
- Carry context. Add a short note to each chunk: the title, the section range, and any definitions the later pages rely on.
- Merge afterwards. Ask each chunk for structured output, then combine and reconcile in code or in a final call.
Before and after
Weak plan: split a 240-page contract every 40 pages, ask each chunk
"summarise", paste the six summaries together.
Better: split at Parts 1-6, send each with the definitions page,
ask for obligations as JSON with page numbers, merge in code,
then ask one final question over the merged JSON.
What goes wrong
- Dense pages. Small-font pages and complex tables can fill the context window before the page cap.
- Lost cross-references. Clause 14 refers to a definition on page 3, which is in another chunk.
- Trusting a count. The page cap is not a promise that 600 dense pages fit.
Examples
Sizing a 300-page report
A report has 300 pages and the model has a 200k-token window. At 1,500 to 3,000 text tokens per page, 300 pages is 450,000 to 900,000 tokens of text alone, before images. It cannot go in one request.
Plan: split into 8 to 10 chapter-aligned parts of about 30 pages each, send the glossary with every part, ask for JSON findings with page numbers, and merge.
Chunk header note
You are reading Part 3 of 6 (pages 81-120) of the 2025 supply contract.
Definitions from pages 3-5 are attached first. Quote page numbers.
This short note keeps each chunk anchored and makes the merged output traceable.
Key points
- Four limits apply together: request size, page count, image count and the context window; the first one reached fails the request.
- Claude's docs give 128 MB per request and 600 pages, or 100 pages under a 1M-token context window; other providers use different numbers.
- A PDF page typically costs 1,500 to 3,000 text tokens plus up to 1,568 visual tokens, so dense documents hit the window before the page cap.
- Split on structure such as chapters or invoices, and carry definitions and titles into every chunk.
- Ask each chunk for structured output with page references and merge in code so cross-chunk facts can be reconciled.
Common mistakes
- Checking only the page cap and ignoring the context window, so a dense 80-page PDF still fails.
- Splitting every N pages instead of at structural boundaries, which cuts tables and clauses in half.
- Splitting without carrying definitions or titles into each chunk.
- Merging chunk summaries as free text, which hides disagreements between chunks.
Check yourself · 2 of 3
Where is the best place to cut a long contract into chunks?
Check yourself · 3 of 3
A 90-page PDF averages 2,000 text tokens per page. What is the minimum text-token cost of sending it once?
Practice items, not counted towards your mastery.
Start here
- PDF support (Claude docs) (opens in a new tab)DocsFree
Request limits, the three ways to send a PDF, and how pages are read as text plus images.
- Vision (Claude docs) (opens in a new tab)DocsFree
Image formats, resolution and token cost, multi-image labelling and the stated accuracy limits.
- Files API (Claude) (opens in a new tab)DocsFree
Upload a file once and reference it by id; covers the per-file size cap.