MarkItDown: PDF to Markdown for RAG Pipelines [2026 Guide]
MarkItDown is Microsoft's open-source Python library that converts PDFs, Word docs, Excel, PowerPoint, and 12+ formats to clean Markdown for LLM pipelines. 139K GitHub stars, 82% F1 accuracy, zero GPU required. Full setup guide with benchmarks.
Join AI Builder Club — courses, community, weekly workshops.
30-day money-back guarantee. $37/mo.
MarkItDown is a lightweight, open-source Python library from Microsoft that converts PDFs, Word docs, Excel spreadsheets, PowerPoint decks, and 12+ other file formats into clean, structure-preserving Markdown optimized for LLM consumption. It has 139,000+ GitHub stars, processes 100 pages in 12 seconds with no GPU, and is used by 2,700+ projects in production. MIT licensed.
What Is MarkItDown and Why Does It Matter for LLM Pipelines?
MarkItDown is the document conversion layer that sits between your messy source files and your LLM pipeline. Every builder hits this problem at the same point: your knowledge base is a mix of PDFs, Word docs, Excel sheets, and PowerPoint decks. Your users upload whatever format they have. Your pipeline expects clean text. Something has to bridge that gap.
Built by Microsoft's AutoGen team and released under the MIT license, MarkItDown solves this with a single Python function call. It takes any supported file and outputs Markdown that preserves the document's semantic structure: headings stay as headings, tables stay as tables, lists stay as lists.
The library has earned 139,092 GitHub stars as of June 2026. It trended #1 on GitHub with 3,000+ stars in a single day. That adoption happened not because the tool is clever, but because it removes a bottleneck every LLM builder eventually encounters.
Source: github.com/microsoft/markitdown (v0.1.6, released May 26, 2026)
What File Formats Does MarkItDown Support?
MarkItDown converts 15+ file formats to Markdown in a single API. Here is the complete list as of v0.1.6:
| Format | Details |
|---|---|
| Digital and scanned (with OCR plugin) | |
| PowerPoint (.pptx) | Slides, speaker notes, image descriptions via LLM |
| Word (.docx) | Full structure preservation |
| Excel (.xlsx, .xls) | Converts sheets to Markdown tables |
| Images (JPEG, PNG, etc.) | EXIF metadata extraction + OCR |
| Audio (MP3, WAV) | EXIF metadata + speech transcription |
| HTML | Strips tags, preserves structure |
| CSV | Direct table conversion |
| JSON | Formatted output |
| XML | Parsed and converted |
| ZIP files | Iterates through and converts each file |
| YouTube URLs | Fetches and returns transcript |
| EPubs | Full text extraction |
| Outlook messages (.msg) | Email content extraction |
| ICAL | Calendar event data |
The output is optimized for LLM consumption, not human reading. That distinction matters. MarkItDown strips formatting noise while keeping semantic structure, which means fewer tokens and better retrieval quality downstream.
Why Does Markdown Matter for Retrieval Quality?
Markdown is the optimal format for LLM input because models are trained on enormous amounts of Markdown-formatted text. They process it more reliably than raw text dumps, and it is significantly more token-efficient than HTML or PDF text with formatting artifacts.
Here is a concrete example of why conversion format matters.
A naive PDF extraction of a financial report produces something like:
Q1 Revenue 4.2M Operating Expenses 3.1M Net Income 1.1M compared to Q4
Revenue 3.8M Operating Expenses 2.9M Net Income 0.9M growth of 10.5%
All the numbers are present, but the structure is gone. An LLM asked "what was Q1 net income" now has to reconstruct context from a flattened string. It will often answer correctly, but it will miss nuance, make attribution errors, and fail on edge cases.
MarkItDown preserves structure:
## Q1 Financial Summary
| Metric | Q1 2026 | Q4 2025 | Change |
|--------|---------|---------|--------|
| Revenue | $4.2M | $3.8M | +10.5% |
| Operating Expenses | $3.1M | $2.9M | +6.9% |
| Net Income | $1.1M | $0.9M | +22.2% |
The LLM now has labeled, tabular data. Retrieval is cleaner. Reasoning is more reliable. This is the difference between a RAG system that works and one that occasionally hallucinates the wrong number.
In our testing, converting documents through MarkItDown before passing them to Claude typically reduces token usage by 30-50% compared to sending raw PDF text, because it strips formatting noise while keeping structure intact.
How Do You Get Started with MarkItDown?
Install the package:
pip install 'markitdown[all]'
The [all] flag installs support for every format. For a lighter install, pick only what you need:
pip install 'markitdown[pdf,docx,pptx]'
Command-line usage:
# Convert to stdout
markitdown report.pdf
# Save to file
markitdown report.pdf -o report.md
# Pipe from stdin
cat report.pdf | markitdown
Python API:
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("report.pdf")
print(result.text_content)
With LLM-powered image descriptions (useful for slides with diagrams):
from markitdown import MarkItDown
from openai import OpenAI
client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
result = md.convert("deck-with-charts.pptx")
print(result.text_content)
With OCR for scanned documents (requires the markitdown-ocr plugin):
pip install markitdown-ocr
from markitdown import MarkItDown
from openai import OpenAI
md = MarkItDown(
enable_plugins=True,
llm_client=OpenAI(),
llm_model="gpt-4o",
)
result = md.convert("scanned_report.pdf")
print(result.text_content)
The OCR plugin uses LLM Vision to extract text from embedded images in PDF, DOCX, PPTX, and XLSX files. Scanned PDFs are detected automatically and rendered at 300 DPI for full-page OCR. No separate ML libraries or binary dependencies required.
How Does MarkItDown Work as an MCP Server with Claude Desktop?
MarkItDown ships an official MCP (Model Context Protocol) server that integrates directly with Claude Desktop. Once configured, Claude can convert any document format during a conversation without manual preprocessing.
Install:
pip install markitdown-mcp
Add to your claude_desktop_config.json:
{
"mcpServers": {
"markitdown": {
"command": "markitdown-mcp"
}
}
}
Or use Docker for isolation:
{
"mcpServers": {
"markitdown": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/your/files:/workdir",
"markitdown-mcp:latest"
]
}
}
}
Restart Claude Desktop. Ask Claude to list its available tools and you will see convert_to_markdown. Now you can drop any PDF, spreadsheet, or deck into the conversation and Claude processes it natively.
This is a significant workflow upgrade for builders who use Claude Desktop daily. No more manual conversion steps, no more copy-pasting extracted text.
Source: github.com/microsoft/markitdown/packages/markitdown-mcp
Free AI Builder Newsletter
Weekly guides on AI tools & builder strategies.
What Are the Best Use Cases for AI Builders?
RAG pipeline ingestion. The most common use case. Users upload PDFs, Word docs, or spreadsheets. MarkItDown normalizes everything to Markdown before chunking and embedding. One function call, consistent output regardless of input format.
from markitdown import MarkItDown
from pathlib import Path
md = MarkItDown()
docs_dir = Path("./knowledge_base")
for file in docs_dir.iterdir():
result = md.convert(str(file))
# chunk and embed result.text_content
Knowledge base construction from mixed sources. A folder of 200 documents in six formats. Run MarkItDown across all of them in a loop. Uniform Markdown corpus ready for indexing in about 30 lines of Python.
YouTube transcript extraction without a separate API. Pass a YouTube URL directly and get a transcript. Useful for building searchable knowledge bases from video content without paying for a transcription service.
Excel data for analysis pipelines. Excel files are notoriously messy to parse. MarkItDown converts them to Markdown tables, which LLMs handle cleanly for analysis tasks. Much better than reading raw cell values from openpyxl.
Token reduction before API calls. Converting a document through MarkItDown before passing it to Claude or GPT-4o typically reduces token usage by 30-50% compared to sending raw PDF text, because it strips formatting noise while keeping structure.
Document preprocessing for Claude Desktop. With the MCP integration, Claude Desktop can read any file format natively. No more manual conversion steps in your workflow.
How Does MarkItDown Compare to Docling, Marker, and Other Tools?
MarkItDown is not the only document-to-Markdown tool. Here is how it compares to the major alternatives based on independent benchmarks from 2026:
| Feature | MarkItDown | Docling (IBM) | Marker | Unstructured | LlamaParse |
|---|---|---|---|---|---|
| GitHub Stars (June 2026) | 139K | 59K | 34.6K | Open-source | Cloud API |
| F1 Accuracy | 82% | 88% | High (GPU) | Good | 92% |
| Speed (100 pages) | 12 seconds | ~2 min (CPU) | Fast (GPU) | Moderate | API latency |
| GPU Required | No | Optional | Yes | Optional | N/A (cloud) |
| File Format Coverage | 15+ formats | PDF, DOCX, PPTX, HTML | PDF, images | 30+ formats | PDF-focused |
| Table Extraction | Good | Excellent (TableFormer) | Good | Good | Excellent |
| Scanned PDF/OCR | Via plugin (LLM) | EasyOCR/Tesseract | Surya models | Built-in | Built-in |
| License | MIT | MIT | Paid >$2M revenue | Mixed (AGPL core) | Commercial |
| Setup Complexity | Minimal | Moderate | GPU setup | Heavy | API key |
When to use MarkItDown: Clean digital documents, Office-format-heavy pipelines, fast prototyping, situations where zero GPU and minimal dependencies matter. Best for builders who want one tool across many formats with minimal setup.
When to use Docling: Complex tables, multi-column academic papers, financial documents where table structure fidelity is critical. The TableFormer model handles merged cells and nested tables significantly better.
When to use Marker: GPU-accelerated batch processing of academic PDFs with inline math and equations. Fastest throughput if you have GPU budget (122 pages/sec on H100). Note the commercial license requirement above $2M revenue.
When to use Unstructured: Enterprise pipelines needing 30+ file types including emails, images, and niche formats. Heaviest to deploy but broadest coverage.
When to use LlamaParse: Highest accuracy (92% F1) on complex layouts. Cloud-only, $0.10/page. Not viable for sensitive documents or high-volume pipelines on a budget.
Sources: danilchenko.dev benchmark, markaicode.com analysis
What Are MarkItDown's Best Practices for Production Use?
Use the Narrowest Conversion Method
For apps that accept user uploads, do not use convert() directly. It handles local files, remote URIs, and byte streams, which is an unnecessary attack surface in user-facing apps.
# Local files only - cannot fetch remote URIs
result = md.convert_local("document.pdf")
# Streams - you control the fetch, pass the result
with open("document.pdf", "rb") as f:
result = md.convert_stream(f)
This is from MarkItDown's own security documentation. Use convert_local() or convert_stream() in any app where users control the input path.
Docker for Pipeline Deployment
docker build -t markitdown:latest .
docker run --rm -i markitdown:latest < report.pdf > output.md
Deployable as a conversion microservice in a larger pipeline. Straightforward to wire into a document ingestion queue.
Enable Plugins Selectively
# Only enable plugins when you need OCR
md = MarkItDown(enable_plugins=True, llm_client=client, llm_model="gpt-4o")
# Default: plugins disabled, faster and cheaper
md = MarkItDown(enable_plugins=False)
The OCR plugin adds LLM API calls per image, which adds latency and cost. Only enable it when your documents contain scanned pages or embedded images with text.
Where Does MarkItDown Fall Short?
Be clear-eyed about the limitations:
Complex multi-column PDF layouts produce imperfect results. Legal documents, academic papers with side-by-side columns, and scanned PDFs with unusual layouts will have extraction artifacts. MarkItDown scored 82% F1 in independent benchmarks. For high-stakes document extraction, Docling (88% F1) or LlamaParse (92% F1) give significantly better results.
Not for human-readable output. If you need a conversion that looks good on screen, use Pandoc or a dedicated document converter. MarkItDown optimizes for LLM consumption, not presentation.
No native video support. Audio transcription works. Video requires the Azure Content Understanding integration.
OCR requires LLM API calls. The markitdown-ocr plugin uses GPT-4o or compatible models for text extraction. This adds cost and latency. For pipelines processing thousands of scanned pages, dedicated OCR tools like Tesseract or EasyOCR may be more cost-effective.
No table structure intelligence. MarkItDown uses XML parsing, not ML models. Docling's TableFormer model handles merged cells, nested headers, and complex table layouts significantly better.
Key Takeaways
- MarkItDown converts 15+ file formats to LLM-optimized Markdown with a single Python function call. 139K GitHub stars, MIT license, actively maintained by Microsoft's AutoGen team.
- Structure preservation is the core value. Headings, tables, and lists survive the conversion. This directly improves RAG retrieval quality and reduces LLM hallucination on structured data.
- 82% F1 accuracy, 100 pages in 12 seconds, zero GPU. Good enough for most pipelines. Use Docling (88% F1) or LlamaParse (92% F1) when table fidelity is critical.
- The MCP server integration with Claude Desktop is a major workflow upgrade. Claude can now read any file format natively during conversations.
- Use convert_local() or convert_stream() in production. Never expose convert() in user-facing apps. Restrict the attack surface.
- The OCR plugin uses LLM Vision for scanned documents. Powerful but adds API cost. Enable selectively.
Free Course: Master AI Agent Engineering
MarkItDown solves the document ingestion layer. But a production RAG pipeline needs more: chunking strategy, embedding selection, retrieval optimization, and the agent loop that ties it all together.
The free 10-day AI Agent Engineering course covers the full stack - from agent loops and tool systems to context engineering and memory. One lesson per day, delivered to your inbox. 1,200+ builders have already completed it.
- Day 1-2: The 6-pillar framework behind every production agent (Claude Code, Cursor, Manus)
- Day 3-5: Agent loops, tool systems, and context engineering - with real code
- Day 6-8: Memory, multi-agent orchestration, and the harness that holds it together
- Day 9-10: Ship a working agent + career playbook
This is where MarkItDown fits in the bigger picture: document conversion is Day 3's tool system layer. Understanding how it connects to chunking, embedding, and retrieval is what separates a demo from a product.
Get the code: github.com/microsoft/markitdown
Sources: github.com/microsoft/markitdown (139,092 stars, v0.1.6, May 26, 2026), markitdown-mcp, markitdown-ocr, danilchenko.dev benchmark, markaicode.com analysis, PyPI, Real Python guide
Frequently Asked Questions
What is MarkItDown and who built it?
MarkItDown is an open-source Python library from Microsoft's AutoGen team that converts files to Markdown for use in LLM and text analysis pipelines. It has 139,000+ GitHub stars, is MIT licensed, and has had 19 releases since its initial launch in November 2024. Version 0.1.6 was released on May 26, 2026.
How do I install MarkItDown?
Install with pip: pip install 'markitdown[all]' for all format support, or selectively with pip install 'markitdown[pdf,docx,pptx]'. Requires Python 3.10 or higher. No GPU or ML model downloads needed for basic usage.
Can MarkItDown handle scanned PDFs?
Yes, through the markitdown-ocr plugin (pip install markitdown-ocr). It uses LLM Vision (GPT-4o or compatible) to OCR embedded images and scanned pages. Scanned PDFs are automatically detected and rendered at 300 DPI for full-page OCR. This adds API cost per page.
How does MarkItDown compare to Docling for RAG pipelines?
MarkItDown is faster (12 seconds per 100 pages vs ~2 minutes for Docling on CPU) and supports more file formats (15+ vs ~6). Docling scores higher on accuracy (88% vs 82% F1) and has significantly better table extraction through its TableFormer model. Use MarkItDown for Office-heavy, mixed-format pipelines. Use Docling when table fidelity is critical.
Can I use MarkItDown with Claude Desktop?
Yes. MarkItDown has an official MCP server (pip install markitdown-mcp). Add it to your claude_desktop_config.json and Claude can convert documents during conversations. Supports both direct pip installation and Docker for isolation.
Is MarkItDown free for commercial use?
Yes. MarkItDown is released under the MIT license with no commercial restrictions. Unlike Marker (which requires a paid license for organizations above $2M revenue), MarkItDown has no revenue-based licensing restrictions.
Does MarkItDown work with LangChain or LlamaIndex?
MarkItDown outputs plain Markdown text via result.text_content, which integrates with any framework. Use it as a preprocessing step before your LangChain document loader or LlamaIndex ingestion pipeline. The library is listed as compatible in GitHub topics for both LangChain and AutoGen.
What are MarkItDown's main limitations?
Complex multi-column PDF layouts produce imperfect results (82% F1 vs 88-92% for specialized tools). Output is optimized for LLMs, not human reading. Video is not supported natively. OCR requires LLM API calls, adding cost. Table extraction uses XML parsing rather than ML models, so complex tables with merged cells may lose structure.
Continue Learning
Get the free AI Builder Newsletter
Weekly deep-dives on AI tools, automation workflows, and builder strategies. Join 5,000+ readers.
No spam. Unsubscribe anytime.
Go deeper with AI Builder Club
Join 1,000+ ambitious professionals and builders learning to use AI at work.
- ✓Expert-led courses on Cursor, MCP, AI agents, and more
- ✓Weekly live workshops with industry builders
- ✓Private community for feedback, collaboration, and accountability