# MarkItDown

> Convert PDFs, Office docs, and more into clean Markdown for LLMs

- Category: Retrieval & Knowledge (RAG) / Parsing & Ingestion
- Language: Python
- Repository: https://github.com/microsoft/markitdown
- Canonical page: https://ai-tldr.dev/tools/markitdown/

## In short

MarkItDown is a lightweight Python utility from Microsoft that converts many file types into Markdown. It supports PDF, PowerPoint, Word, Excel, images, audio, HTML, text formats like CSV/JSON/XML, ZIP archives, EPubs, and YouTube URLs, preserving structure such as headings, lists, tables, and links. It sits in the Parsing & Ingestion category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python.

## Overview

MarkItDown is a lightweight Python utility from Microsoft that converts many file types into Markdown. It supports PDF, PowerPoint, Word, Excel, images, audio, HTML, text formats like CSV/JSON/XML, ZIP archives, EPubs, and YouTube URLs, preserving structure such as headings, lists, tables, and links.

It is built for feeding documents into LLMs and text-analysis pipelines, not for high-fidelity conversions meant for human reading. Markdown stays close to plain text while keeping document structure, and mainstream models handle it well and token-efficiently. The project compares itself to textract, with a stronger focus on retaining structure.

It fits the web scraping and data extraction space as a normalization step: take mixed source files and turn them into one consistent text format your prompts and pipelines can consume. It runs as a command-line tool or as a Python library.

## What it does

- Converts PDF, Word, PowerPoint, Excel, HTML, and text formats (CSV, JSON, XML) into Markdown
- Handles images (EXIF metadata and OCR), audio (metadata and speech transcription), EPubs, ZIP archives, and YouTube URLs
- Optional dependency groups (e.g. [pdf], [docx], [pptx]) let you install only the formats you need
- Command-line interface with file, -o output, and piped stdin input
- Supports third-party plugins, including markitdown-ocr for LLM-based OCR of embedded images
- Optional Azure Document Intelligence and Azure Content Understanding backends for higher-quality and structured extraction

## Getting started

MarkItDown requires Python 3.10 or higher; a virtual environment is recommended. Install it with pip, then convert files from the command line or in Python.

1. Install with pip

   Install MarkItDown with all optional format dependencies. You can also install only the groups you need, e.g. 'markitdown[pdf, docx, pptx]'.

```bash
pip install 'markitdown[all]'
```

2. Convert a file from the command line

   Pass a file path and redirect the Markdown output, or use -o to set the output file.

```bash
markitdown path-to-file.pdf > document.md
```

3. Use it from Python

   Create a MarkItDown instance, convert a file, and read the Markdown from the result's text_content.

```python
from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("document_with_images.pdf")
print(result.text_content)
```

## When to use it

- Preparing PDFs, Word, and PowerPoint documents as Markdown context for LLM prompts or RAG pipelines
- Normalizing a folder of mixed file types into one consistent text format for analysis
- Extracting text and structure from spreadsheets, HTML pages, or EPubs in a data pipeline
- Transcribing audio or pulling YouTube transcripts into Markdown for downstream processing
