Python tool for converting files and office documents to Markdown for LLMs and text analysis pipelines
Convert virtually any file format to structured Markdown for AI processing
PDF, Word, PowerPoint, Excel files with preserved structure including headings, tables, and lists
Extract EXIF metadata and perform OCR on images to get text content
Speech transcription from audio files and YouTube video content
Convert HTML pages and web URLs to clean Markdown representation
Process ZIP files and iterate through their contents for conversion
Convert EPubs to Markdown for easy reading and analysis
Comprehensive support for all your document conversion needs
The perfect format for LLMs and text analysis pipelines
Markdown is extremely close to plain text with minimal markup, but still provides a way to represent important document structure.
Mainstream LLMs like OpenAI's GPT-4o natively "speak" Markdown and often incorporate it into their responses unprompted.
This suggests they've been trained on vast amounts of Markdown-formatted text and understand it well.
As a side benefit, Markdown conventions are also highly token-efficient.
Install MarkItDown in seconds and start converting files
# Install with all optional dependencies
pip install 'markitdown[all]'
# Install specific format support
pip install 'markitdown[pdf, docx, pptx]'
# Command line usage
markitdown path-to-file.pdf > document.md
# Python API usage
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)
Extend MarkItDown with custom conversion capabilities
Extract text from embedded images using LLM Vision
# Install the OCR plugin
pip install markitdown-ocr
pip install openai
# Usage with LLM
from markitdown import MarkItDown
from openai import OpenAI
md = MarkItDown(
enable_plugins=True,
llm_client=OpenAI(),
llm_model="gpt-4o"
)
result = md.convert("document_with_images.pdf")
print(result.text_content)
Enhance conversion quality with Microsoft cloud services
| Capability | Built-in Converters | Azure Document Intelligence | Azure Content Understanding |
|---|---|---|---|
| Document Conversion | Offline, format-specific | Cloud layout extraction | Cloud multimodal extraction |
| Structured Fields | Not available | Not exposed | YAML front matter |
| Audio/Video | Basic audio only | Not supported | Full support |
| Cost | Local compute only | Billable API calls | Billable API calls |
Safe file conversion practices
MarkItDown performs I/O with the privileges of the current process. Like open() or requests.get(), it will access resources that the process itself can access.
Do not pass untrusted input directly to MarkItDown. Validate and restrict inputs in hosted or server-side applications.
Prefer the narrowest conversion method that fits your use case: convert_local(), convert_response(), or convert_stream().
Restrict file paths, limit URI schemes, and block access to private or metadata-service addresses in untrusted environments.
Contribute to MarkItDown and help shape the future of file conversion