127K ⭐
8.7K 🍴
671 🐛

MarkItDown

Python tool for converting files and office documents to Markdown for LLMs and text analysis pipelines

Powerful File Conversion

Convert virtually any file format to structured Markdown for AI processing

📄

Document Conversion

PDF, Word, PowerPoint, Excel files with preserved structure including headings, tables, and lists

🖼️

Image Processing

Extract EXIF metadata and perform OCR on images to get text content

🎵

Audio & Video

Speech transcription from audio files and YouTube video content

🌐

Web Content

Convert HTML pages and web URLs to clean Markdown representation

📦

Archive Support

Process ZIP files and iterate through their contents for conversion

📚

E-books

Convert EPubs to Markdown for easy reading and analysis

Supported File Formats

Comprehensive support for all your document conversion needs

📄
PDF
📊
Excel
📝
Word
📑
PowerPoint
🖼️
Images
🎵
Audio
🌐
HTML
📦
ZIP
🎬
YouTube
📖
EPub
📋
CSV
🔧
JSON/XML

Why Markdown?

The perfect format for LLMs and text analysis pipelines

Markdown: The Language of AI

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.

# Document Structure Example ## Section 1 - Bullet point 1 - Bullet point 2 ### Subsection Some important text with **bold** and *italic* formatting. ## Section 2 | Header 1 | Header 2 | |----------|----------| | Cell 1 | Cell 2 | | Cell 3 | Cell 4 | [Link to resource](https://example.com)

Quick Start

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)

Plugin System

Extend MarkItDown with custom conversion capabilities

🔍

OCR Plugin with LLM Vision

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)

Azure Integration Options

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

Security Considerations

Safe file conversion practices

⚠️ Important Security Notice

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.

🛡️ Sanitize Inputs

Do not pass untrusted input directly to MarkItDown. Validate and restrict inputs in hosted or server-side applications.

🎯 Use Narrow APIs

Prefer the narrowest conversion method that fits your use case: convert_local(), convert_response(), or convert_stream().

🔒 Access Control

Restrict file paths, limit URI schemes, and block access to private or metadata-service addresses in untrusted environments.

Join the Community

Contribute to MarkItDown and help shape the future of file conversion