Guide · MarkItDown

MarkItDown PDF to Markdown: practical guide

MarkItDown is a lightweight Python utility for turning documents into Markdown for LLMs and text pipelines. It is fast to install and easy to call, but it is not a high-fidelity publishing converter.

Updated November 23, 2026 · Markdown2PDF by Hyperdyn

What MarkItDown is designed for

MarkItDown converts PDF, Word, PowerPoint, Excel, HTML, EPUB and other files into Markdown. Its goal is useful text and document structure for analysis, search and LLM prompts. Headings, lists, tables and links are preserved when the source makes them detectable.

The project itself warns that its output is not necessarily the best high-fidelity conversion for human-facing documents. If you need carefully reconstructed layouts, compare it with Marker or Docling on your own files.

Install MarkItDown

MarkItDown supports Python 3.10 through 3.14. Install only the PDF extra if you do not need the other formats:

python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS / Linux: source .venv/bin/activate
pip install 'markitdown[pdf]'

Use pip install 'markitdown[all]' if you need PowerPoint, Word, Excel, audio or the other optional converters.

Convert a PDF with the MarkItDown CLI

The command-line interface writes Markdown to standard output or to a file:

markitdown input.pdf -o output.md

You can also pipe a file into the command. Use -o when you want a named output file, and check the exit status in scripts so a failed conversion does not silently produce an empty document.

Use MarkItDown from Python

from markitdown import MarkItDown

md = MarkItDown(enable_plugins=False)
result = md.convert_local("input.pdf")

with open("output.md", "w", encoding="utf-8") as handle:
    handle.write(result.markdown)

convert_local() is the narrowest method for a local file. The broader convert() method can also handle URLs and streams, which is convenient but expands the input surface. Choose the narrowest method that fits your use case.

Treat untrusted PDFs carefully

MarkItDown performs I/O with the privileges of the current process. If you feed it files or URLs supplied by strangers, validate the input first. Restrict local paths, block private and loopback network addresses, and avoid exposing a broad conversion endpoint to the public internet.

For a one-off local conversion, that risk is manageable. For a hosted service, it is a security boundary that needs deliberate design.

When MarkItDown output is good enough

MarkItDown is a good fit for text-heavy reports, notes and LLM ingestion where exact visual fidelity is not required. It is a weaker fit for complex tables, scanned documents, equations or a PDF that must become a polished human-readable Markdown document.

For a more layout-aware pipeline, see the Marker guide or the Docling guide. If you already have Markdown and need a finished PDF, open the Markdown to PDF converter.

Frequently asked questions

Is MarkItDown the same as a PDF to Markdown online converter?

No. MarkItDown is a local Python utility and command-line tool. It does not upload your file to a conversion website, although some optional features may call web-hosted services.

Does MarkItDown need OCR for scanned PDFs?

The core PDF converter extracts what the PDF exposes. Scanned pages normally need OCR, and the optional OCR plugin relies on an LLM vision provider. Check the current MarkItDown documentation before relying on it for scans.

Can MarkItDown preserve tables?

It attempts to preserve tables and other document structure, but the result is aimed at machine-readable text. Complex tables may need manual repair.