SuperAPI AI Directory

markitdown

Python tool for converting files and office documents to Markdown.

Open website

About this tool

Purpose

MarkItDown is a lightweight Python tool for converting various files to Markdown, primarily aimed at large language models (LLMs) and related text analysis pipelines. It is designed to preserve important document structure (headings, lists, tables, links, etc.) so that the output is easy for text analysis tools to consume, rather than pursuing high-fidelity document conversion for human reading.

Main capabilities

MarkItDown supports conversion from the following formats:

  • Images (EXIF metadata and OCR)
  • Audio (EXIF metadata and speech transcription)
  • Text formats (CSV, JSON, XML)
  • ZIP files (iterating over their contents)
  • Office documents such as PDF, Word, Excel, PowerPoint, Outlook email, and more
  • YouTube video transcription (via optional dependencies)

Its output is in Markdown format, close to plain text with very little markup, while still being able to express document structure. Mainstream LLMs (such as OpenAI GPT-4o) natively support Markdown, and Markdown markup has relatively high token efficiency.

Usage

MarkItDown requires Python 3.10 to 3.14. It is recommended to use a virtual environment to avoid dependency conflicts.

Install:

pip install 'markitdown[all]'

Or install from source.

Command-line usage:

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

Or use -o to specify the output file:

markitdown path-to-file.pdf -o document.md

Content can also be piped in.

Basic Python API usage:

from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("test.xlsx")
print(result.text_content)

If you want to use a large language model to generate image descriptions (currently only pptx and image files are supported), you can provide llm_client and llm_model:

from openai import OpenAI
client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
result = md.convert("example.jpg")
print(result.text_content)

max_retries to control the number of automatic retries for the OpenAI client (default 2); when set to 5, it will attempt up to six times with backoff.

Optional dependencies

You can use [all] to install all optional dependencies, or install them individually as needed:

  • [all]: install all optional dependencies
  • [pptx]: PowerPoint file dependencies
  • [docx]: Word file dependencies
  • [xlsx]: Excel file dependencies
  • [xls]: legacy Excel file dependencies
  • [pdf]: PDF file dependencies
  • [outlook]: Outlook email dependencies
  • [az-doc-intel]: Azure Document Intelligence dependencies
  • [az-content-understanding]: Azure Content Understanding dependencies
  • [audio-transcription]: wav and mp3 audio transcription dependencies
  • [youtube-transcription]: dependencies for obtaining YouTube video transcripts

For example, pip install 'markitdown[pdf, docx, pptx]' will install only the dependencies for PDF, DOCX, and PPTX.

Plugins

MarkItDown supports third-party plugins, which are disabled by default. List installed plugins:

markitdown --list-plugins

Enable plugins:

markitdown --use-plugins path-to-file.pdf

You can search GitHub for the tag #markitdown-plugin to find available plugins. For plugin development, refer to packages/markitdown-sample-plugin。

markitdown-ocr plugins add OCR support to the PDF, DOCX, PPTX, and XLSX converters, using LLM Vision to extract text from embedded images, following the same llm_client / llm_model pattern as MarkItDown image descriptions, without adding new ML libraries or binary dependencies. You need to pass in the same llm_client and llm_modelas for image descriptions; if llm_clientis not provided, the plugin will still load, but OCR will be silently skipped and the standard built-in converters will be used instead. See packages/markitdown-ocr/README.mdfor details.

Azure Content Understanding

Provides higher-quality conversion, with support for structured field extraction (YAML front matter), multimodality (documents, images, audio, video), and configurable analyzers. Install:

pip install 'markitdown[az-content-understanding]'

Use cases include: audio and video files (the built-in converter has no video support, audio only has basic transcription, CU is the only option for video and is also the higher-quality cloud option for audio); structured field extraction (preset or custom analyzers extract domain-specific fields, such as invoice amounts, receipt dates, contract terms, serialized as YAML front matter); higher-quality document extraction (cloud-based layout analysis and OCR for scanned PDFs, complex tables, and multi-page documents); a unified API for all modalities (a single cu_endpoint handles documents, images, audio, and video, automatically routing analyzers). The endpoint can also be set once in an environment variable, and callers only need --use-cu. When using a custom analyzer (for domain-specific field extraction), set cu_analyzer_id , and the converter will automatically restrict compatible file types based on the analyzer's modality; incompatible types (such as processing an audio file with a document analyzer) are automatically routed to the default preset analyzer. Cost note: each convert() call on a CU-routed format is a billed Azure API call. You can use cu_file_types to restrict which formats are routed to CU. For more information, see the Azure Content Understanding documentation.

Azure Document Intelligence

Use Microsoft Document Intelligence for conversion. The endpoint can also be set once in an environment variable, and callers only need -d. For more setup information, see the Azure Document Intelligence resource documentation. Usage in Python:

from markitdown import MarkItDown
md = MarkItDown(docintel_endpoint="<document_intelligence_endpoint>")
result = md.convert("test.pdf")
print(result.text_content)

Use cases

MarkItDown is suitable for converting various documents to Markdown for LLM consumption or text analysis. Its output is usually readable and human-friendly, but it is not a high-fidelity conversion intended for human consumption. If a web service, API, or graphical interface is needed, the official recommendation is to maintain it as a separate package or project depending on markitdown on PyPI.

Limitations

  • Requires Python 3.10 to 3.14.
  • The built-in converter has no video support, and audio only supports basic transcription.
  • The output is primarily designed for text analysis tools and may not be the best choice for high-fidelity document conversion.
  • Each conversion of a CU-routed format incurs Azure API billing.
  • Plugins are disabled by default.

Security considerations

MarkItDown performs I/O with the permissions of the current process. Similar to open() or requests.get() , it can access resources accessible to the process itself. In untrusted environments, sanitize input and call the narrowest convert_* function (such as convert_stream() or convert_local()). Do not pass untrusted input directly to MarkItDown; if any part of the input may be controlled by an untrusted user or system (such as in a hosted or server-side application), it must be validated and constrained before calling. Depending on the environment, this may include restricting file paths, restricting URI schemes and network destinations, and blocking access to private, loopback, link-local, or metadata service addresses. Prefer the narrowest conversion API: theconvert() method is intentionally permissive and can handle local files, remote URIs, and byte streams; if the application only needs to read local files, call convert_local(); if more control over URI fetching is needed, you can call requests.get() yourself and pass the response object to convert_response(); for maximum control, open an input stream and call convert_stream(). See the security considerations section in the documentation for details.