Hack the Hydra

How to convert PDF to Markdown for LLMs

Short answer: extract the PDF to Markdown (headings, lists, tables), remove repeated headers and footers, then either paste it into the chat or split it on headings into chunks for retrieval. Use OCR for scanned pages. A free in-browser converter handles single files, and an API handles batches.

Free PDF to Markdown converter →

Free PDF to Markdown converter: the tool with a sample file converted

1. Extract

Use a converter that keeps structure. Open the PDF to Markdown converter, drop your file, and download the .md. If the result is nearly empty, the PDF is scanned: use OCR or the API.

2. Clean

Delete running headers, page numbers, tables of contents and legal boilerplate. They waste tokens and pollute retrieval.

3. Structure

Check that section titles became Markdown headings. If not, add # and ## yourself: headings are what both the model and your chunker rely on.

4. Use

Chat: paste the Markdown and ask the model to cite the heading it used. RAG: split on headings, cap chunks around 500–1,000 tokens, store the heading path as metadata. See PDF to Markdown for RAG.

5. Scale

For hundreds of files, call the PDF to Markdown API from your pipeline. It detects tables, OCRs scanned pages and only charges for successful files.

Worked example: a 12-page report

Suppose you want a model to answer questions about a 12-page annual report. A typical page of dense English text is around 500 to 700 words, which is roughly 700 to 1,000 tokens, so the whole report is about 10,000 tokens: small enough to paste into most current chat models in one go.

  1. Convert it with the PDF to Markdown converter.
  2. Delete the cover page, the table of contents and the repeated footer ("Annual report 2025 | page 7").
  3. Check that the two financial tables came out as Markdown tables. If one did not, copy it from the PDF by hand; tables are where answers usually come from.
  4. Paste it with a short instruction: "Answer only from the report below. Quote the section heading you used."

For a 300-page manual the same text would be around 250,000 tokens. Do not paste it: split it on headings and use retrieval instead.

Should you paste the Markdown or retrieve it?

SituationPaste the MarkdownChunk + retrieval
One document, under ~50 pagesYesNot needed
Many documents or a whole libraryNoYes
Questions that need the whole document (summaries)YesHarder
Precise lookups in long manualsCostlyYes

Which pitfalls should you check before trusting the answers?

FAQ

Why Markdown instead of plain text?

Markdown keeps structure (headings, lists, tables) at almost no token cost, which improves both answers and retrieval.

How many tokens is a PDF page?

Typically 400 to 800 tokens of English text per page, more for dense papers.

Can I paste a whole PDF into ChatGPT or Claude?

Short documents, yes. Long ones are better split on headings and searched with retrieval, which is cheaper and more precise.

Last updated: November 2026. Facts about third-party tools come from their public repositories and documentation. Check licenses before commercial use.

Try it now

Free PDF to Markdown converter →