Launch offer: Pro yearly at $29
Docuflat

PDF to Markdown for AI: why text beats the PDF

Updated 29 October 2026 · 4 min read

PDF is a format designed for printing. It records where each letter sits on a page, not how the text is structured. That's perfect for a printer and awkward for an AI model, which needs the words, in order, with a sense of what's a heading and what's a list.

Markdown is the opposite: a plain-text format where structure is written with a few simple symbols.

# Supply Agreement

## Clause 1: Payment
Payment is due within **30 days** of invoice.

- Late payments carry 1.5% monthly interest
- Disputes must be raised in writing

AI models are trained on enormous amounts of Markdown, from documentation and code repositories to chat transcripts. They read it fluently and often reply in it.

Benefits of converting first

  • Only the words. A PDF holds fonts, images and layout data as well as text. Markdown holds the text and a little structure. File size is not the point (see the measurements below); what matters is what the AI has to process.
  • Often fewer tokens. Where a tool reads PDF pages as images as well as text, as the Claude API does, pasted text avoids the image tokens. You can also delete repeated headers, footers and pages you don't need. See how to use fewer tokens with documents.
  • More reliable. You can read the Markdown yourself before sending it, so you know exactly what the assistant sees. With a PDF, you're trusting the tool's own extraction, which can scramble columns or skip text.
  • Editable. You can delete irrelevant pages, fix an OCR mistake, or add a note before you paste it.
  • Works everywhere. Plain text can be pasted into any chat, any model, any app, and doesn't depend on whether a tool accepts attachments.

How to convert a PDF to Markdown

  1. Open the converter and drop your PDF onto it.
  2. Pages that contain real text are read directly. Pages that are only images (scans) are run through OCR in your browser. Pick the document's language in the OCR box first.
  3. Preview the result, then download the .md file or copy it.

Each page is marked with a heading such as ## Page 3, so you and the AI can refer to page numbers. Pages converted with OCR are labelled (OCR) so you know which parts to double-check.

What converts well, and what doesn't

PDF content Result
Typed text, letters, contracts, reports Exact text, instantly
Scanned pages and photocopies OCR text: check names and numbers
Multi-column layouts Usually correct reading order; check complex pages
Tables Text in rows; the grid lines are not kept
Charts, photos, signatures Not included (they are images)

If a table matters, ask the assistant to "rebuild this as a Markdown table" after pasting. Models are good at this when the numbers are in the right order.

What we measured

We converted four sample files with Docuflat on 21 October 2026 and counted the tokens in the results with OpenAI's published tokenizers (o200k_base, used by GPT-4o-family models, and the older cl100k_base). The files are synthetic, so you can repeat the test: contract.pdf, policy.docx, price-list.xlsx and price-list.csv.

Sample Original Markdown Tokens (o200k) Tokens (cl100k) Docuflat's estimate
Typed contract, 6 pages (PDF) 8.9 KB 10.7 KB 2,211 2,219 2,262
Policy with headings and a table (DOCX) 37 KB 3.4 KB 660 663 697
Price list, 200 rows (XLSX) 10 KB 7.6 KB 3,734 3,735 3,575
Same price list (CSV) 5.5 KB 7.7 KB 3,866 3,866 3,671

What this shows:

  • File size and tokens are different things. The typed PDF was smaller than its Markdown. A PDF only gets large when it carries scans, photos or embedded fonts, and none of that is text the AI reads.
  • Tables cost more tokens per character. Numbers and table symbols split into short tokens: about 2 characters per token in the price list, against about 5 in the contract. Send only the rows and columns you need.
  • Language matters a lot. The same short notice took 62 tokens in English, 79 in Hindi, 85 in Bengali, 89 in Gujarati and 106 in Tamil with o200k_base. With the older cl100k_base, Hindi took 290 and Gujarati 425: about four to seven times more.

What we could not measure here: how many tokens an attached PDF uses inside ChatGPT, Claude or Gemini apps, because they don't publish how they process attachments. On the Claude API, Anthropic's documentation says each PDF page is read as text (typically 1,500 to 3,000 tokens a page) and also as an image, which is charged on top. Pasting the text instead avoids the image part.

The token figure Docuflat shows next to each result is an estimate tuned to o200k_base, within about 15% on these samples. Claude, Gemini and other models use their own tokenizers, so their counts differ.

Scanned PDFs

A scanned PDF is really a set of photos. To get text out of it you need OCR (optical character recognition). See how to convert a scanned PDF to text for tips on getting accurate results.

More guides