Illustration of what markitdown does: Python tool that turns PDFs, Office files, audio and more into Markdown for LLMs

microsoft /

markitdown

Python tool that turns PDFs, Office files, audio and more into Markdown for LLMs

  • 191.7k stars
  • 3.8k stars since 3 Oct
  • Python
  • Updated today
  • Beginner friendly
  • Memory, RAG & data

LLMs and text-analysis tools work best with clean text, but real documents come as PDFs, slide decks, spreadsheets and scans. MarkItDown reads many of these formats and writes Markdown, which stays close to plain text while keeping structure like headings, lists, tables and links.

You can use it as a command-line tool or as a Python library. Each file type has its own converter, and extra dependencies are installed per format, so you only pull in what you need. If you pass in an OpenAI-compatible client, an LLM can describe images and read text from images embedded in documents. Third-party plugins can add more formats.

The README compares it to textract, but says it focuses on preserving document structure. The output is meant for machines to read, so it may not suit cases where a person needs a faithful copy of the original layout. For harder documents it can call paid Azure services (Document Intelligence or Content Understanding) instead of its offline converters.

What it does

  • Many input formats

    Handles PDF, PowerPoint, Word, Excel, images (EXIF and OCR), audio (metadata and transcription), HTML, CSV, JSON, XML, ZIP, EPub and YouTube URLs.

  • CLI and Python API

    Run markitdown on a file, use -o for an output file, or pipe content in. In Python, call convert() and read result.markdown.

  • Optional extras per format

    Install only what you need, such as markitdown[pdf, docx, pptx], or use [all] for everything.

  • LLM image descriptions and OCR

    Pass an llm_client and llm_model to describe images in PowerPoint and image files. The markitdown-ocr plugin uses the same pattern to read text from images inside PDF, DOCX, PPTX and XLSX files.

  • Azure options and plugins

    Can use Azure Document Intelligence or Content Understanding for higher-quality, billable cloud conversion. Plugins are off by default and enabled with --use-plugins.

What you could build

  • Convert a folder of PDFs and Word files into Markdown before indexing them for a RAG system.
  • Turn a PowerPoint deck or Excel sheet into text you can paste into an LLM prompt.
  • Transcribe audio or pull a YouTube transcript into text for analysis.
  • Describe images in slides or photos using a vision-capable model.
  • Extract invoice fields into YAML front matter using an Azure Content Understanding analyzer.

Get started

Use Python 3.10 or newer, ideally in a virtual environment, and install with the [all] extra. Then run markitdown on a file and redirect the output to a .md file.

pip install 'markitdown[all]'
markitdown path-to-file.pdf > document.md

Commands are copied from the project's README. Read it on GitHub for the full setup.

More in Memory, RAG & data

    ↑↓ to move, Enter to open, Esc to close