Complete Guide • Updated 2026

How to Convert PDF to Markdown

A complete guide to extracting clean, structured markdown from PDF files—with or without code

Converting PDF files to markdown is one of the most common document conversion tasks for developers, researchers, and content creators. Whether you're building a RAG system, migrating documentation, or just want your PDFs in a more editable format, this guide covers everything you need to know.

Quick Answer: The Easiest Way

The fastest way to convert PDF to markdown is using a browser-based converter like Craft Markdown's free PDF to Markdown tool. No installation, no code, no uploads to servers—just drag, drop, and download a .md file with headings, lists and simple tables picked up.

One thing to know up front: a PDF stores positioned text, not headings and tables. Plain extractors (pdftotext, MarkItDown's default) give you the text in reading order. Craft Markdown and pdf2md use heuristics such as font size for headings, and Craft Markdown also turns aligned columns into simple tables. Tools that run layout models (Docling, LlamaParse) go furthest, including complex tables, multi-column pages and OCR. Pick based on what you need from the document.

For those who prefer code or need automation, we'll cover command-line and Python tools later in this guide.


Why Convert PDF to Markdown?

Before diving into the how, let's understand why markdown is the ideal target format:

1. AI and LLM Readiness

Markdown is the best format for feeding content to ChatGPT, Claude, or RAG systems:

  • Token efficiency: Markdown uses 30-50% fewer tokens than HTML or JSON
  • Better embeddings: Clean text produces higher-quality vector embeddings
  • Improved retrieval: RAG systems show up to 35% better accuracy with markdown vs raw PDF text

2. Future-Proof and Portable

  • Plain text format that will never become obsolete
  • Works with any text editor
  • Version control friendly (Git, SVN, etc.)
  • Platform independent

3. Easy to Edit and Search

  • Edit in Obsidian, Typora, VS Code, or any markdown editor
  • Full-text search with grep, ripgrep, or built-in tools
  • No proprietary software required

4. Structure You Can Add or Recover

  • Markdown headings (#) make the document outline explicit
  • Pipe tables keep data readable
  • Lists keep their hierarchy
  • Links stay clickable

How much of that comes out of the PDF automatically depends on the tool: plain text extractors give you the words and you add the headings; Craft Markdown guesses headings from font size and picks up lists and simple tables; layout-aware tools like Docling recover the most, including complex tables.


Method 1: Browser-Based Converter (Recommended)

Best for: Most users, one-time conversions, privacy-conscious workflows

Step 1: Open the Converter

Go to Craft Markdown's PDF to Markdown Converter. No signup required.

Step 2: Drop Your PDF

Drag and drop your PDF file onto the converter interface. Your file is processed entirely in your browser—nothing gets uploaded to a server.

Step 3: Get Your Markdown

  • Download the .md file (or a ZIP if you dropped several PDFs)
  • Open it and check the result: headings come from font size, lists and simple tables are picked up, and repeating page headers and footers are dropped; fix any heading levels or complex tables by hand

Why This Method Wins

✅ Zero setup — Works immediately, no installation
✅ 100% private — Files never leave your browser
✅ Fast — Results in seconds
✅ Free — No limits, no signup
✅ Clean text — Wrapped lines rejoined, hyphenated words mended, repeating headers, footers and page numbers dropped, control characters stripped, ready to paste into an AI chat

❌ Structure is heuristic — headings come from font size (three levels), tables only when columns line up over three or more lines; complex tables and unusual layouts come out as plain text
❌ No OCR — scanned PDFs come out empty, and images are not extracted

Try it now →


Method 2: pdftotext and MarkItDown (Command Line)

Best for: Developers, automation, batch conversions

A note on Pandoc

Pandoc is the standard document converter, but it has no PDF reader: pandoc input.pdf fails. Use one of the tools below to get text or Markdown out of the PDF, then Pandoc if you need to go on to another format.

pdftotext (Poppler)

macOS:

brew install poppler

Ubuntu/Debian:

sudo apt install poppler-utils

Convert:

pdftotext -layout input.pdf output.md

This gives you the plain text of every page, scripted, without the headings, lists and simple tables Craft Markdown tries to recover.

MarkItDown (Microsoft)

pip install 'markitdown[pdf]'
markitdown input.pdf -o output.md

MarkItDown's default PDF output is also plain text (it uses pdfminer). Its OCR plugin and Azure Document Intelligence option add scanned-page support. See our MarkItDown online page for the full comparison.

Batch conversion

for f in documents/*.pdf; do
  pdftotext -layout "$f" "output/$(basename "$f" .pdf).md"
done

Command-Line Pros & Cons

Pros:

  • Scriptable for hundreds of files
  • Free and open-source
  • Local processing

Cons:

  • Requires installation
  • Plain text output, no headings or tables
  • No visual interface

Method 3: Python with Libraries

Best for: Developers building custom pipelines, automation

Using pdfplumber + markdownify

import pdfplumber
from markdownify import markdownify as md

# Extract text from PDF
with pdfplumber.open("input.pdf") as pdf:
    text = ""
    for page in pdf.pages:
        text += page.extract_text()

# Convert to markdown (basic)
markdown_output = md(text)

# Save to file
with open("output.md", "w") as f:
    f.write(markdown_output)

Using PyMuPDF (fitz)

import fitz  # PyMuPDF

doc = fitz.open("input.pdf")
markdown = ""

for page in doc:
    markdown += page.get_text()

with open("output.md", "w") as f:
    f.write(markdown)

Using Docling (for headings and tables)

Docling, from IBM Research, runs layout and table-structure models on each page and is the best free way to get real headings and pipe tables out of a PDF. It also includes OCR for scans.

from docling.document_converter import DocumentConverter

result = DocumentConverter().convert("input.pdf")
with open("output.md", "w") as f:
    f.write(result.document.export_to_markdown())

The first run downloads model weights, and long documents are slower than plain extraction.

Python Method Pros & Cons

Pros:

  • Full control over extraction
  • Docling recovers headings, tables and reading order
  • Good for batch processing
  • Integrates with data pipelines

Cons:

  • Requires Python knowledge
  • Plain extractors (pdfplumber, PyMuPDF) need manual formatting
  • Docling is heavier to install and run
  • More code to maintain

Method 4: Online Converters (Compare)

Craft Markdown vs pdf2md.morethan.io

Feature Craft Markdown pdf2md.morethan.io
Privacy ✅ Browser-based ✅ Browser-based
PDF output Headings from font size, lists, bold, headers/footers dropped Headings from font sizes, lists, bold, italic, headers/footers dropped
Multi-format support ✅ 12 formats ❌ PDF only
Several files at once ✅ ZIP download ❌ One at a time
Free ✅ Unlimited ✅ Unlimited
Tables ✅ Simple aligned tables; complex as cell text ❌ Cell text

Verdict: Both keep your file private and both guess headings from font size. Craft Markdown also builds simple tables and adds batch conversion and eleven other formats; pdf2md keeps italic and code blocks. See the full Craft Markdown vs pdf2md comparison.

Convert PDF to Markdown Free →


Best Practices for PDF to Markdown Conversion

1. Use Digital-Native PDFs

PDFs created from Word, Google Docs, or LaTeX convert better than scanned PDFs. If your PDF has selectable text (you can highlight it), you're good to go.

2. Handle Scanned PDFs Carefully

Scanned PDFs require OCR (Optical Character Recognition):

  • Quality varies based on scan resolution
  • Expect some errors in text extraction
  • Consider using Adobe Acrobat or Tesseract OCR first

3. Clean Up After Conversion

Even the best converters may need minor cleanup:

  • Check table formatting
  • Verify heading levels
  • Fix broken links
  • Adjust list indentation

4. Optimize for AI/LLM Use

If you're converting for RAG systems or LLM training:

  • Remove headers and footers
  • Clean up page numbers
  • Remove artifacts from PDF formatting
  • Ensure heading hierarchy is correct

5. Preserve Document Structure

  • Keep heading hierarchy (#, ##, ###)
  • Maintain table structure
  • Preserve list formatting
  • Keep internal links

Common Issues and Solutions

Issue: "My PDF comes out as gibberish"

Cause: The PDF likely contains scanned images, not selectable text.

Solution:

  1. Check if text is selectable in the PDF
  2. If not, use OCR software first (Adobe Acrobat, Tesseract)
  3. Or try a different PDF export from the source document

Issue: "Tables aren't converting properly"

Cause: A PDF table is just positioned text. Plain text extractors output the cells in reading order. Craft Markdown builds a pipe table only when three or more consecutive lines share the same aligned columns; tables with merged cells, wrapped cell text or multi-line headers come out as text.

Solution:

  1. If you have the original DOCX, HTML or a CSV export, convert that instead
  2. Use a layout-aware tool such as Docling or LlamaParse on the PDF
  3. For critical tables, recreate them by hand

Issue: "Images aren't included"

Cause: Text-based converters extract text, not embedded images.

Solution:

  1. Extract images separately from the PDF
  2. Save images to a folder
  3. Reference images in markdown: ![Alt text](./images/image.png)

Issue: "Formatting is lost"

Cause: Markdown is intentionally simple and doesn't support complex formatting.

Solution:

  • Bold and italic convert fine
  • Colors, fonts, and layouts are stripped (this is a feature for clean text)
  • For rich formatting, consider HTML instead of markdown

Use Cases: When to Convert PDF to Markdown

1. Building RAG Systems

Convert PDFs to markdown before ingesting into vector databases:

# Example: PDF → Markdown → Embeddings
markdown_text = convert_pdf_to_markdown("research_paper.pdf")
chunks = split_into_chunks(markdown_text)
embeddings = create_embeddings(chunks)
store_in_vector_db(embeddings)

Markdown produces better embeddings than raw PDF text because:

  • No PDF artifacts
  • Clean structure
  • Consistent formatting

2. Migrating Documentation

Moving from PDF-based docs to markdown-based systems (MkDocs, Docusaurus, Hugo):

  • Convert all PDFs to markdown
  • Add frontmatter and metadata
  • Deploy as static site
  • Enable search and version control

3. Research and Note-Taking

Convert research papers and ebooks to markdown for Obsidian, Roam Research, or Notion:

  • Full-text search across all papers
  • Link between notes
  • Annotate and highlight
  • Build a personal knowledge base

4. LLM Training Data Preparation

Extract text from PDF books and papers for LLM fine-tuning:

  • Clean, structured text
  • Preserves document hierarchy
  • Removes formatting noise
  • Ready for tokenization

5. Content Archival

Future-proof your PDFs by converting to markdown:

  • Plain text lasts forever
  • No proprietary format lock-in
  • Git version control
  • Easy migration to new tools

Comparison: Which Method Should You Use?

Method Best For Difficulty Privacy Output
Craft Markdown Most users, quick conversions ⭐ Easy ✅ Browser Headings, lists, simple tables
pdftotext / MarkItDown Developers, automation ⭐⭐⭐ Hard ✅ Local Plain text
Docling Headings and tables, scans ⭐⭐⭐⭐ Expert ✅ Local Structured Markdown
Cloud parsers (LlamaParse) Complex documents at scale ⭐⭐⭐ Hard ❌ Uploaded Structured Markdown

Our recommendation: Start with Craft Markdown's browser PDF to Markdown converter. Reach for Docling when complex tables, multi-column pages or scans matter, and for scripting use pdftotext or MarkItDown.


Frequently Asked Questions

Can I convert scanned PDFs to markdown?

Only after OCR. Scanned PDFs are images, and the PDF to Markdown converter reads the text layer only, so a scan comes out empty. Run the scan through Adobe Acrobat, Tesseract, or Docling (which has OCR built in) first; then convert the result. Quality depends on scan resolution and font clarity.

Is PDF to markdown conversion free?

Yes! Craft Markdown's converter is completely free with no limits. Open-source tools like Pandoc are also free.

How do I preserve formatting when converting PDF to markdown?

Markdown intentionally has limited formatting (bold, italic, headers, lists, tables). Complex formatting like colors, fonts, and layouts won't convert. This is a feature—clean markdown is better for AI, searchability, and long-term archival.

What's the best tool for converting PDF to markdown?

For most text-based PDFs, Craft Markdown's browser-based converter is the easiest choice: free, private (no uploads), no installation, with headings, lists and simple tables picked up. For complex tables and scans, Docling is the best free tool. For developers who need automation, pdftotext or MarkItDown are the simplest command-line options.

Can I batch convert multiple PDFs to markdown?

Yes. Drop several PDFs on our converter at once and download them as a ZIP. For hundreds of files, use a pdftotext, MarkItDown or Docling script.

Will this work for PDFs with images?

The text converts; images are not included in the output. Export images separately and link them in the markdown.


Next Steps

Ready to convert your PDFs to clean, AI-ready markdown?

→ Try the Free PDF to Markdown Converter

No signup required. Privacy-first. Instant results.

Want to learn more?


Summary

Converting PDF to markdown is simple with the right tool:

  1. For most users: Use Craft Markdown's free online converter to get the text with headings, lists and simple tables
  2. For developers: Use pdftotext, MarkItDown or Docling scripts
  3. For complex tables and scans: Use Docling (local) or LlamaParse (cloud)
  4. For privacy: Choose browser-based or local tools (no server uploads)

The key is choosing clean, structured markdown output optimized for your use case—whether that's AI/ML, documentation, or personal knowledge management.

Convert your first PDF now → Free PDF to Markdown Converter