DURBEEN / INDEPENDENT LAB. AN ENGINEER TESTING AI ON REAL WORK.LOG UPDATED 22.11.2026 · N°002

Why PDFs cost more tokens, and the simple fix I use

PDF pages cost more tokens than plain text. Here is the simple fix I use: convert files to Markdown first with MarkItDown, and when to upload the PDF anyway.

Fahad EhsanFounder, Durbeen3 MIN READ
Why PDFs cost more tokens: a PDF is read as text plus a page image; MarkItDown turns it into a text-only Markdown file

When you upload a PDF to Claude, you pay for more than the words. Every page is read as an image and as text, so a long PDF uses up your usage fast. I fixed this with a small Mac workflow called TokenSave. This guide explains the idea, and shows a simple version you can try without my setup.

Why PDFs cost more

Anthropic’s documentation says each PDF page is processed in two ways: as an image, and as the text extracted from it. You pay for both. Claude’s docs say each PDF page typically uses 1,500–3,000 text tokens, and because every page is also turned into an image, image tokens are added on top. You can read the details in the PDF support docs.

That is useful when the page has a chart or a diagram. It is a waste when the page is only words.

The fix: convert to Markdown first

Markdown is plain text. There is no page image, only the words, with simple marks for headings, lists and tables. So I convert the file to Markdown first, and upload the .md file instead of the PDF.

For the conversion I use MarkItDown. It is free and made by Microsoft. It turns PDF, Word, Excel and PowerPoint files into Markdown.

How TokenSave works

TokenSave version 1.0 is finished, and it is my own Mac workflow. It runs in four steps:

  1. Drop. I drop a file into a topic folder inside an Inbox folder in Google Drive.
  2. Convert. Hazel, a paid Mac automation app, notices the new file and runs my script, tokensave.sh. The script calls MarkItDown.
  3. Clean. The script removes the junk (more on that below) and adds a source header at the top.
  4. Ready. The Markdown file is saved in a Ready folder. The original is archived. A Mac notification shows an estimated token count, and a line is added to a CSV log.

If a PDF is a scan with no text in it, there is nothing to convert. The script moves that file to a Needs-OCR folder instead.

What it cleans, and what it never removes

The script removes:

  • page numbers
  • table-of-contents lines
  • repeated footers
  • empty table rows
  • extra blank lines

The safety rule is simple: when unsure, a line is kept. A repeated line is only removed if it looks like a footer. A little junk left in the file is better than a lost sentence.

Limits, and when to upload the PDF anyway

  • Images and diagrams are lost. Markdown keeps the words only. I tested it on a short networking lab guide that was full of screenshots. The text converted cleanly, but every screenshot was lost, including the command outputs shown as images. If the pictures matter, upload the PDF.
  • Scanned PDFs need OCR first. The script flags them, but it does not read them.
  • The token count is an estimate. It is the number of characters divided by four. It is a guide, not a bill.

So when the charts, diagrams or layout matter, do not convert. Upload the PDF. That is what the extra tokens are for.

Try it yourself

You do not need Hazel or my script. This is the simplest version: install MarkItDown, then convert one file.

pip install 'markitdown[all]'
markitdown path-to-file.pdf -o document.md

MarkItDown needs Python 3.10 or newer. If your Mac has an older Python (macOS ships 3.9), install it with uv instead:

uv tool install --python 3.12 'markitdown[all]'

Then open document.md and read it. Check that the text looks right, and upload that file to Claude instead of the PDF. For a rough token estimate, count the characters and divide by four.

If it works well on one file, you can automate it later. That is all TokenSave is: this one command, plus folders and a cleanup script.