How to fix “context window exceeded” in ChatGPT and Claude

7 August 2026 · Milldown team · All posts

You upload a PDF, ask one question, and the model tells you the conversation is too long — or quietly forgets the first half of the document. The file isn't too big. It's too expensive in tokens, and most of those tokens are avoidable.

Why a 5 MB PDF can overflow a 200K context window

Context windows are measured in tokens, not megabytes. A dense, text-heavy PDF can produce far more tokens than a much larger image-heavy one — and native PDF upload makes it worse. When you attach a PDF directly, the model typically processes each page as extracted text plus a page image; Anthropic documents roughly 1,500–3,000 tokens per page for Claude. On a 100-page document that image overhead alone can be 150,000–300,000 tokens — before a single word of your question.

Worse: attached files are re-read on every turn of the conversation. That overhead isn't paid once, it's paid each time you ask a follow-up — which is why long document chats degrade and eventually hit the wall.

The fix, in order of impact

  1. Convert the document to Markdown before you paste it.Plain Markdown carries the same words with none of the format overhead. Across our test corpus, converting PDFs cut token usage by 60–75% versus native PDF upload.
  2. Strip the boilerplate.Repeated page headers, footers, page numbers, and navigation chrome are pure noise. Milldown's Clean Up pass removes them without touching the content.
  3. Split by headings, not by page count.If the document still doesn't fit, split the Markdown at its heading structure so each chunk is a self-contained section. Feeding a model half a table is worse than feeding it one whole chapter.
  4. Send only the sections the question needs.For a contract question about termination clauses, the model doesn't need the appendices. Markdown makes documents skimmable and croppable in a way PDFs never are.
  5. Start a fresh chat when the topic changes.A 150-page document lingering in history taxes every later message. New topic, new conversation.

Measured, not estimated. Milldown counts tokens with the same o200k tokenizer the frontier models use, on your actual files. On our test documents: PDFs drop 60–75% versus native upload, web pages 53–66% versus raw HTML, and Word/PowerPoint files over 97% versus their underlying XML. The badge in the app shows the exact number for each file you convert.

What about prompt caching?

One honest caveat you won't find on most converter sites: if you use the API with prompt caching, repeated reads of the same attachment get much cheaper, so the dollar savings of conversion shrink on later turns. What doesn't shrink is the context-window saving — a cached PDF still occupies the same enormous slice of the window. If your problem is “conversation too long” rather than cost, Markdown remains the fix.

Doing this on a Mac

Milldown converts PDFs, Word, PowerPoint, Excel, EPUB, and web pages to clean Markdown entirely on your Mac — nothing is uploaded, and scanned PDFs are OCR’d on-device. Drop the file, watch the token badge, copy the result into ChatGPT or Claude. See the format guides for specifics: PDF, Word, scanned PDFs.

Stop feeding your AI page furniture

Convert documents to clean, token-efficient Markdown — entirely on your Mac. Free for 14 days.

Get Milldown for macOS

macOS 14+ · Apple Silicon · $39 one-time after trial (excl. VAT) · no subscription