MarkItDown

Turn PDFs, Office files, images and audio into LLM-ready Markdown from one command

Python tool for converting files and office documents to Markdown.

Category
Developer tools
Audience
Developers
Language
Python
Licence
MIT

Updated

MarkItDown is a lightweight Python utility from Microsoft that converts files and office documents into Markdown for large language models and text analysis pipelines. It is built for developers who have to get real-world documents — a scanned contract, a quarterly spreadsheet, a slide deck, a recorded call — into a form a model can actually read. The README is honest about the trade-off up front: the output is meant to be consumed by text analysis tools, and it is not the best option for high-fidelity conversion aimed at human readers.

What it does

MarkItDown takes a file in and gives Markdown out, with a deliberate focus on preserving the structure that carries meaning: headings, lists, tables and links. The inputs listed in the README are:

  • PDF
  • Word, PowerPoint and Excel
  • Images, with EXIF metadata and OCR
  • Audio, with EXIF metadata and speech transcription
  • HTML
  • Text-based formats such as CSV, JSON and XML
  • ZIP files, iterating over their contents
  • YouTube URLs
  • EPub

The audio and YouTube handling is the part most people do not expect. A recording comes back as a transcript, a YouTube link comes back as its captions, and both travel the same path as your PDFs — so one ingestion step covers a mixed pile of source material instead of three separate scripts.

How it works

The case for Markdown is spelled out in the README. Markdown sits extremely close to plain text, with minimal markup, yet still represents important document structure. Mainstream models such as OpenAI's GPT-4o natively "speak" Markdown and often produce it unprompted, which suggests they were trained on a great deal of it and understand it well. As a side benefit, Markdown conventions are highly token-efficient. So the format is both structure-preserving and cheap to put in a prompt, which is exactly the combination a retrieval or agent pipeline wants.

Conversion is exposed as a family of convert_* functions rather than a single catch-all call, and that distinction is a safety feature, not an API accident. The README leads with the warning: MarkItDown performs I/O with the privileges of the current process, much like open() or requests.get(), and it will reach whatever that process can reach. The guidance is to sanitize inputs in untrusted environments and to call the narrowest function your use case needs — convert_stream() for bytes you already hold, convert_local() for a file on disk — rather than handing it an identifier that might resolve to something remote.

Getting started

MarkItDown is published on PyPI as markitdown, so installing it is an ordinary Python package install; the README carries both a PyPI version badge and a daily-download badge. From there you can drive it from the command line — point it at a file, get Markdown back — or import it and call the conversion functions from your own code, which is where the narrower convert_* entry points matter.

The license is MIT, so it drops into commercial products without licensing friction. The repository's GitHub topics say plainly where it is meant to sit: autogen, autogen-extension, langchain, openai, pdf, markdown, microsoft-office. It is the document-ingestion stage in front of an agent or retrieval framework, not a publishing tool.

When to use it / when not

Use it when a machine is the reader. If you are building retrieval-augmented search, an agent that has to reason over uploaded files, or any pipeline that turns a directory of mixed documents into text chunks, MarkItDown removes a whole category of format-specific glue code — one library instead of a PDF parser, an Office reader, an OCR wrapper and a transcription client.

Skip it when a person is the reader and fidelity matters. The project says outright that it may not be the best choice for high-fidelity document conversion for human consumption; if you need faithful layout, pixel-accurate page reproduction or publication-quality output, this is the wrong tool. Be careful, too, with files you did not produce: because conversion runs with the current process's privileges, untrusted uploads deserve sanitization and the narrowest conversion call available.

Alternatives

The README points at the closest comparison itself: textract, the older general-purpose extraction library. The stated difference is emphasis. Where textract pulls text out, MarkItDown aims to keep the document's shape as it does so — headings stay headings, tables stay tables — because that structure is what a language model uses to understand the document.

If you are building anything that feeds documents to a model, this is worth a serious look. It is Microsoft-maintained, MIT-licensed, actively pushed, and it has drawn an enormous amount of attention since it appeared in late 2024 — over 181,000 stars and more than 13,000 forks. The scope is narrow and the promise is modest: files in, structured Markdown out, with a clear statement of what it is not good at. That honesty is a large part of why it belongs in a pipeline rather than on a wish list.

More in Developer tools

All of Developer tools →