Markitdown logo

Markitdown

OrganizationPopular
microsoft

Python tool for converting files and office documents to Markdown.

Publishermicrosoft
Repositorymarkitdown
LanguagePython
Forks
8.3K
Stars
123.1K
Available tools
1
Transport typestdio
LicenseMIT
Links
  • Connect tools to AI workflows

    Markitdown exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 1 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    123.1K stars and 8.3K forks from the linked repository.

MarkItDown

PyPI PyPI - Downloads Built by AutoGen Team

[!IMPORTANT] 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 your inputs in untrusted environments, and call the narrowest convert_* function needed for your use case (e.g., convert_stream(), or convert_local()). See the Security Considerations section of the documentation for more information.

MarkItDown is a lightweight Python utility for converting various files to Markdown for use with LLMs and related text analysis pipelines. To this end, it is most comparable to textract, but with a focus on preserving important document structure and content as Markdown (including: headings, lists, tables, links, etc.) While the output is often reasonably presentable and human-friendly, it is meant to be consumed by text analysis tools -- and may not be the best option for high-fidelity document conversions for human consumption.

MarkItDown currently supports the conversion from:

  • PDF
  • PowerPoint
  • Word
  • Excel
  • Images (EXIF metadata and OCR)
  • Audio (EXIF metadata and speech transcription)
  • HTML
  • Text-based formats (CSV, JSON, XML)
  • ZIP files (iterates over contents)
  • Youtube URLs
  • EPubs
  • ... and more!

Why Markdown?

Markdown is extremely close to plain text, with minimal markup or formatting, but still provides a way to represent important document structure. Mainstream LLMs, such as OpenAI's GPT-4o, natively "speak" Markdown, and often incorporate Markdown into their responses unprompted. This suggests that they have been trained on vast amounts of Markdown-formatted text, and understand it well. As a side benefit, Markdown conventions are also highly token-efficient.

Prerequisites

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

With the standard Python installation, you can create and activate a virtual environment using the following commands:

bash
python -m venv .venv
source .venv/bin/activate

If using uv, you can create a virtual environment with:

bash
uv venv --python=3.12 .venv
source .venv/bin/activate
# NOTE: Be sure to use 'uv pip install' rather than just 'pip install' to install packages in this virtual environment

If you are using Anaconda, you can create a virtual environment with:

bash
conda create -n markitdown python=3.12
conda activate markitdown

Installation

To install MarkItDown, use pip: pip install 'markitdown[all]'. Alternatively, you can install it from the source:

bash
git clone git@github.com:microsoft/markitdown.git
cd markitdown
pip install -e 'packages/markitdown[all]'

Usage

Command-Line

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

Or use -o to specify the output file:

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

You can also pipe content:

bash
cat path-to-file.pdf | markitdown

Optional Dependencies

MarkItDown has optional dependencies for activating various file formats. Earlier in this document, we installed all optional dependencies with the [all] option. However, you can also install them individually for more control. For example:

bash
pip install 'markitdown[pdf, docx, pptx]'

will install only the dependencies for PDF, DOCX, and PPTX files.

At the moment, the following optional dependencies are available:

  • [all] Installs all optional dependencies
  • [pptx] Installs dependencies for PowerPoint files
  • [docx] Installs dependencies for Word files
  • [xlsx] Installs dependencies for Excel files
  • [xls] Installs dependencies for older Excel files
  • [pdf] Installs dependencies for PDF files
  • [outlook] Installs dependencies for Outlook messages
  • [az-doc-intel] Installs dependencies for Azure Document Intelligence
  • [audio-transcription] Installs dependencies for audio transcription of wav and mp3 files
  • [youtube-transcription] Installs dependencies for fetching YouTube video transcription

Plugins

MarkItDown also supports 3rd-party plugins. Plugins are disabled by default. To list installed plugins:

bash
markitdown --list-plugins

To enable plugins use:

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

To find available plugins, search GitHub for the hashtag #markitdown-plugin. To develop a plugin, see packages/markitdown-sample-plugin.

markitdown-ocr Plugin

The markitdown-ocr plugin adds OCR support to PDF, DOCX, PPTX, and XLSX converters, extracting text from embedded images using LLM Vision — the same llm_client / llm_model pattern that MarkItDown already uses for image descriptions. No new ML libraries or binary dependencies required.

Installation:

bash
pip install markitdown-ocr
pip install openai  # or any OpenAI-compatible client

Usage:

Pass the same llm_client and llm_model you would use for image descriptions:

python
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)

If no llm_client is provided the plugin still loads, but OCR is silently skipped and the standard built-in converter is used instead.

See packages/markitdown-ocr/README.md for detailed documentation.

Azure Document Intelligence

To use Microsoft Document Intelligence for conversion:

bash
markitdown path-to-file.pdf -o document.md -d -e "<document_intelligence_endpoint>"

More information about how to set up an Azure Document Intelligence Resource can be found here

Python API

Basic usage in Python:

python
from markitdown import MarkItDown

md = MarkItDown(enable_plugins=False) # Set to True to enable plugins
result = md.convert("test.xlsx")
print(result.text_content)

Document Intelligence conversion in Python:

python
from markitdown import MarkItDown

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

To use Large Language Models for image descriptions (currently only for pptx and image files), provide llm_client and llm_model:

python
from markitdown import MarkItDown
from openai import OpenAI

client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o", llm_prompt="optional custom prompt")
result = md.convert("example.jpg")
print(result.text_content)

Docker

sh
docker build -t markitdown:latest .
docker run --rm -i markitdown:latest < ~/your-file.pdf > output.md

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

How to Contribute

You can help by looking at issues or helping review PRs. Any issue or PR is welcome, but we have also marked some as 'open for contribution' and 'open for reviewing' to help facilitate community contributions. These are of course just suggestions and you are welcome to contribute in any way you like.

AllEspecially Needs Help from Community
IssuesAll IssuesIssues open for contribution
PRsAll PRsPRs open for reviewing

Running Tests and Checks

  • Navigate to the MarkItDown package:

    sh
    cd packages/markitdown
  • Install hatch in your environment and run tests:

    sh
    pip install hatch  # Other ways of installing hatch: https://hatch.pypa.io/dev/install/
    hatch shell
    hatch test

    (Alternative) Use the Devcontainer which has all the dependencies installed:

    sh
    # Reopen the project in Devcontainer and run:
    hatch test
  • Run pre-commit checks before submitting a PR: pre-commit run --all-files

Security Considerations

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 your inputs: 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 hosted or server-side applications, it must be validated and restricted before calling MarkItDown. Depending on your environment, this may include restricting file paths, limiting URI schemes and network destinations, and blocking access to private, loopback, link-local, or metadata-service addresses.

Call only the conversion method you need: Prefer the narrowest conversion API that fits your use case. MarkItDown's convert() method is intentionally permissive and can handle local files, remote URIs, and byte streams. If your application only needs to read local files, call convert_local() instead. If you need more control over URI fetching, call requests.get() yourself and pass the response object to convert_response(). For maximum control, open a stream to the input you want converted and call convert_stream().

Contributing 3rd-party Plugins

You can also contribute by creating and sharing 3rd party plugins. See packages/markitdown-sample-plugin for more details.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "markitdown": {
      "command": "uvx",
      "args": [
        "markitdown-mcp"
      ]
    }
  }
}

Available Tools

  • convert_to_markdown

    Convert a resource described by an http:, https:, file: or data: URI to markdown

Use Markitdown MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Markitdown is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Markitdown as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Markitdown MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "markitdown": {
      "command": "npx",
      "args": [
        "-y",
        "null"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Markitdown MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Markitdown MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Markitdown to help me with this task?
Markitdown
Sure. I read it.
Here is what I found using Markitdown.

Frequently asked questions

What is the Markitdown MCP server used for?

Markitdown is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Markitdown MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Markitdown with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Markitdown MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Markitdown connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Markitdown MCP to TypingMind?

Markitdown runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Markitdown MCP provide in TypingMind?

Markitdown exposes 1 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Markitdown MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Markitdown requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇