Convert PDF to Markdown for LLMs and Docs

By FileConvertLab

Published:

Converting a PDF to Markdown: headings, lists, a table and images come through, page footers need cleanup
Illustration of a PDF page turning into a Markdown file, with a list of elements that survive the conversion and elements that need cleanup

Converting a PDF to Markdown works well for text PDFs with clear, large headings and simple tables: headings, lists, pipe tables, code blocks, links, bold and italic come through, and wrapped lines join back into whole paragraphs. Pictures come along in an images/ folder, linked where they sat on the page. What doesn't make it: the text of scanned pages and the reading order of two-column layouts, and running headers and footers stay in the text. Our PDF to Markdown converter gives you a .md file in one step. This guide shows what we measured on test PDFs and how to clean up the result for an LLM prompt, a RAG index or a docs repository.

How to Convert PDF to Markdown

  1. Check that the PDF has a text layer. Open it and try to select a sentence. If you can't, it's a scan. Skip to the OCR section below — converting a scan directly gives you a picture of each page and no text
  2. Unlock copy-protected files. Some PDFs open without a password but block copying. Run such a file through Unlock PDF first, as long as you have the right to use its text
  3. Upload the PDF to the PDF to Markdown converter. You can pick several files at once: they convert one after another, and "Download all as ZIP" collects the results
  4. Open the .md file in a Markdown editor with a preview (VS Code, Obsidian, Typora) and work through the cleanup checklist below

Guests can upload PDFs up to 100 MB and 20 pages, a free account 100 pages. The file travels over HTTPS; what happens to uploads afterwards is set out in our privacy policy.

What Survives PDF to Markdown

Three kinds of PDF show what the converter keeps and what it loses:

  • Two short documents we wrote ourselves and exported to PDF from an office suite: a setup guide with a title, headings, a bulleted list with a nested level, a numbered list, a table, a code block, bold and italic, and a page with a link and a picture
  • Four pages of the ISO 32000 PDF specification (Adobe's public copy): numbered section headings, reference tables, code examples, running headers and footers
  • A one-page two-column layout we made ourselves
ElementWhat the Markdown contained
Headings in the setup guideAll recognised: # for the title and the sections, ## for the subsection. The title and the sections share a level
Numbered headings in the spec ("7.3.2 Boolean Objects")None became headings. They stayed bold text, **7.3.2 Boolean Objects** — they're bold body-size text, and size is what the converter reads
TablesClean pipe tables in both documents, header row included
Links, bold, italicKept as [text](url), **bold**, *italic*. A space next to a link can slip inside the brackets: [project page ](url)for details
Bulleted lists- list items, with the nested level indented
Numbered lists1. and 2. in order
ParagraphsWrapped lines joined back into one paragraph
Code blockLines in a monospace font got ``` fences. The spec's examples stayed plain paragraphs
ImagesThe download became a ZIP with the .md and an images/ folder. A picture between two paragraphs was linked at that spot; on the short page with a heading, the link landed above the heading
Page breaksA --- rule between pages; running headers and footers ("PDF 32000-1:2008", "© Adobe…") repeated on every page
Two-column layoutLines from both columns merged side by side — unreadable without rework
Scanned PDFA ZIP whose .md holds only a link to a picture of the page, plus a "scanned PDF" warning

The short version: on a clean single-column PDF, lists, tables, code and inline formatting come through; headings only when they're visibly larger than body text. Running headers, footers and two-column layouts need a cleanup pass.

PDF to Markdown for LLMs: ChatGPT, Claude and RAG

Why convert at all, if chat assistants accept PDFs? Because a Markdown file is text you control. You can trim it, split it and reuse it in prompts, a vector index or an API call, and headings give a retrieval pipeline natural places to cut.

Length. Our setup guide came to 512 characters as plain text and 592 as Markdown, which carries the headings and the table structure with it. HTML from a PDF to HTML converter came to 1,809, mostly for the stylesheet and inline style attributes. For an LLM, Markdown is the sweet spot.

Before you chunk by headings, fix the headings. A heading-based splitter trusts # marks. On the spec it would find no headings at all. Check the heading structure first (the cleanup checklist covers this).

Strip running headers and footers. A footer like "© Adobe Systems Incorporated 2008 – All rights reserved" repeats on every page, with its page number. In a RAG index it lands in many chunks and pollutes search results. Delete it with a regex find-and-replace, so the changing number doesn't get in the way.

Keep the --- page rules only if you need page references. They're handy when you want the model to cite a page. Otherwise remove them so a chunk doesn't end mid-sentence.

PDF to Markdown for Docs-as-Code: Git, Obsidian, Static Sites

Markdown is the native format of Git-based documentation. Once a PDF manual is in Markdown, changes show up as readable diffs, and reviewers comment on lines, not pages.

  • Git repositories and wikis: commit the cleaned file, then fix structure in follow-up commits so the history shows what you changed by hand
  • Obsidian: drop the .md file into your vault. Headings appear in the outline pane, and you can link sections with [[note#heading]]
  • Static site generators (Hugo, Jekyll, Docusaurus): add the front matter your generator expects (title, date, slug) at the top of the file
  • Images: unzip the download with its images/ folder next to the .md, so the relative links keep working, and fill in the empty ![]() alt text

Cleanup Checklist After Converting PDF to Markdown

Work through this in order.

  1. Delete running headers and footers and, if you don't need them, the --- page rules
  2. Check the heading outline. Use the outline view of your editor. Promote bold lines that should be headings (**7.3.2 Boolean Objects** → ### 7.3.2 Boolean Objects), and lower the sections by one level if they share # with the title
  3. Fence code that stayed plain. Code in a monospace font arrives fenced; put ``` above and below any other code example
  4. Compare complex tables with the PDF. A pipe table can't hold merged cells, so multi-level headers need a look
  5. Check where the pictures landed in the preview, and move any link that sits away from its paragraph

For a long manual, try this on one chapter first to see whether the result is worth it.

Scanned PDFs: Run OCR First

The converter reads the PDF's text layer. A scan has none, so you get a link to a picture of the page and no text. The fix is two steps:

  1. Make the scan searchable with OCR PDF to searchable PDF, which adds a text layer behind the page images
  2. Convert that searchable PDF to Markdown as usual

The checklist above still applies to the result. If all you need is raw text, OCR PDF to text is one step shorter. Our explainer on how online OCR works covers what affects recognition quality.

When PDF to Markdown Is the Wrong Tool

  • Two-column papers and heavily designed layouts: the columns get interleaved. AI PDF to Word is a separate tool that finds columns and page furniture before it writes a Word file — our AI PDF to Word guide explains when it's worth it
  • You need the page to look the same: keep the PDF, or convert PDF to Word if you have to edit it
  • You're publishing on a web page, not in a repo: see our guide to converting PDF to HTML for the web. Markdown is lighter and easier to diff, HTML is ready for a browser

Summary

PDF to Markdown gives you clean tables, lists and working links from a text PDF, and correct headings when the headings are visibly bigger than the body text. Plan a cleanup pass for running headers and footers, run OCR first on scans, and keep two-column papers away from it. For a single-column report or manual, the PDF to Markdown converter plus the checklist gets you LLM-ready or repo-ready text.

Related Tools

Frequently Asked Questions

Does PDF to Markdown keep headings?

Yes, when the headings are visibly larger than the body text. The title and section headings of a normal report come out as # and ## headings. Headings that are only bold at body size, such as numbered sections in technical standards, stay bold text. Check the outline after converting.

Are tables preserved when converting PDF to Markdown?

Yes. Tables become GitHub-style pipe tables with a header row. A pipe table can't hold merged cells, so compare complex tables with the PDF.

Can I convert a PDF to Markdown with images?

Yes. When the PDF has pictures, the download is a ZIP with the .md file and an images folder, and each picture is linked where it sat on the page. A PDF without pictures still gives a plain .md file.

How do I convert a scanned PDF to Markdown?

Run OCR first. A scan has no text layer, so converting it directly gives a Markdown file with only a link to a picture of the page. Make it searchable with the OCR PDF to searchable PDF tool, then convert the result to Markdown.

Is Markdown better than plain text for ChatGPT or Claude?

For structured documents, usually yes. Markdown is a little longer than plain text but keeps the headings and the table, which helps the model and lets you split the text by section. HTML of the same document came out about three times as long as the Markdown.

Why does the same line repeat on every page?

Those are the PDF's running headers and footers, and the converter keeps them in the text. Delete them with a find-and-replace before you index or publish the file, or they land in many of your chunks.

Does PDF to Markdown work with two-column papers?

Not well. The lines of both columns get merged side by side. For papers, a layout-aware tool that detects columns gives better results, or copy each column separately.

Can I convert several PDFs to Markdown at once?

Yes. Select several PDFs in the file picker. They convert one after another, and you can download each Markdown file or all of them as a ZIP archive.