MarkItDown: give the model the document it actually needs
Microsoft’s MarkItDown converts documents to Markdown before they reach an AI assistant. A practical setup, the MCP option, and where text-only conversion makes sense.
Before reaching for a bigger context window, it is worth looking at what we are putting into the one we already have.
A PDF is designed to preserve a page. An AI task might only need the words on it. Those are different requirements, and a small conversion step can help bridge the gap.
MarkItDown, an open-source Python tool from Microsoft, converts documents into Markdown for language models and text-processing workflows. It supports PDFs and Office documents, among other formats, and aims to retain useful structure rather than reproduce the original page design. Microsoft’s repository is the starting point.
Why convert before uploading?
I came across the tool through a Promptible guide about MarkItDown and Claude. Its central suggestion is useful: if a task only needs text, consider extracting that text before handing the document to the assistant.
The guide describes native PDF handling as “double billing”. I would frame that differently. Anthropic documents a PDF processing path that provides both extracted text and page images to the model. The images make visual analysis possible, and they also contribute to input usage. That is additional information being processed, rather than the same tokens simply being charged twice. Anthropic’s PDF documentation explains the mechanism.
Sending only the extracted Markdown can avoid that visual input when it is unnecessary. The trade-off is that the model no longer sees the original page.
That distinction matters more than a headline savings percentage. A written policy and an architecture diagram need different treatment.
Start with the command line
For a first look, I would keep the workflow explicit: convert a document, inspect the result, then use it in the assistant.
Here is a macOS or Linux setup using a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install 'markitdown[pdf]'
markitdown report.pdf -o report.md
The [pdf] extra installs PDF support. If you need the broader set of optional format dependencies, Microsoft also documents markitdown[all].
Open report.md before uploading it. Check that the sections you need are present and readable. Then attach the Markdown instead of the PDF, or paste the relevant section into your prompt. These commands follow the official installation and CLI instructions.
Keeping the converted file also gives you something you can search, annotate, or reuse in another workflow. For an Obsidian user, it is a convenient format to work with alongside your own notes.
Check what survived conversion
Extraction is a transformation, so it needs a quick quality check.
Microsoft’s built-in PDF converter extracts text and includes table-handling logic. That does not guarantee that every document will retain its intended reading order or relationships. A scan without a usable text layer needs an OCR-capable route; a chart’s meaning may never have existed as extractable text in the first place.
My suggested check is to compare a few representative pages with the Markdown: an ordinary paragraph, a table, and anything with columns or diagrams. Look especially closely at numbers and the labels attached to them.
If understanding the document depends on position, colour, a photograph, or a plotted trend, keep the original PDF or provide the relevant page images. Removing information the task needs is a poor optimisation.
Add MCP when conversion becomes repetitive
Microsoft also provides an official MarkItDown MCP server. It exposes a convert_to_markdown tool that accepts a URI, including a local file: URI.
For a local STDIO setup, install it in your virtual environment:
python -m pip install markitdown-mcp
command -v markitdown-mcp
Use the absolute executable path returned by the second command in your Claude Desktop configuration:
{
"mcpServers": {
"markitdown": {
"command": "/absolute/path/to/.venv/bin/markitdown-mcp",
"args": []
}
}
}
Merge that entry with any existing servers, replace the example path, and restart Claude Desktop. Then explicitly ask it to convert a document using the tool before analysing the resulting text.
Installing the server does not replace Claude’s file-upload pipeline. An ordinary PDF attachment can still use native PDF processing.
The server runs with its process’s file and network access. Microsoft also documents Docker isolation; a restricted, read-only document mount is a useful option when tighter boundaries are needed. See the MCP setup and security notes.
Measure the workflow you use
For a useful comparison, take a representative document and ask the same question twice: once with the original PDF, once with the checked Markdown. Compare answer quality as well as input usage.
For API workflows, use the usage data returned by the API. For a subscription product, avoid translating a token estimate directly into an invoice saving: limits and billing arrangements are a separate question. Reusing a Markdown file also does not make subsequent model input free.
The basic local conversion does not require a model API call, but optional cloud or model-backed processing can introduce charges. Choose the conversion route deliberately. Microsoft’s documentation distinguishes local conversion from those integrations.
What interests me here is the preparation step. For enterprise AI work, document ingestion is part of the system design: decide what information the task needs, check the transformation, and retain the source for verification.
MarkItDown offers a straightforward way to try that approach. Start with one document whose useful content is mostly text, inspect the Markdown, and see whether it makes the next step simpler.
Continue exploring