Start

MarkItDown quickstart: your first conversions in ten minutes

Updated 2026-11-15·Upstream source ↗
Markdown view

You will convert a Word file, the same document as a PDF and an Excel workbook to Markdown, from the command line and from Python, and learn how to judge what comes out. You need Python 3.10 to 3.14, or nothing at all if you use the converter in your browser. Everything here was run on the version in the badge on Windows, macOS and Linux.

Short answer

Install it, convert one file with -o, then read the result:

Command
pip install "markitdown[all]"
Command
markitdown report.docx -o report.md

In Python it is three actions: create a MarkItDown() converter, call convert() on a file, and read .markdown from the result. No install? Convert in your browser.

Tested with markitdown 0.1.9 · Python 3.13 · Ubuntu 24.04, Windows Server 2025 and macOS 26 runners and a Linux lab · 2026-11-15 · evidence: synthetic_report.docx.md, synthetic_pdf-text.pdf.md, synthetic_workbook.xlsx.md, token-counts.csv

What MarkItDown does, in 60 seconds

It turns many kinds of file into one kind of text: Markdown that keeps headings, lists, tables and links and drops the layout. That text is meant for language models and search indexes. There are three doors in: the command line (this page), Python code (step 7) and an MCP server for AI apps (MCP page). It does not convert back, it does not copy the page layout, and it has no built-in OCR for scanned pages (OCR page).

Step 1: Install

The one line

The command at the top installs support for every file type. Quote it: the quotes are required in zsh and harmless in the other shells. Then check:

Command
markitdown --version

You should see markitdown 0.1.9.

If it fails

Other systems

Pick your system, installer and shell in the command builder.

Step 2: Get the sample files

All three are original files we made for this guide and release under CC0.

Put them in the folder you will work in.

Step 3: Convert the Word file

Run it

Use the command from the top of this page, markitdown report.docx -o report.md. -o writes report.md and prints nothing. Open it in any text editor.

Read the output

markitdown report.docx
Pilot Report: Field Station Alpha

# 1. Summary

This report covers **three sites** during *spring 2026* <u>with underlined</u> ~~and struck text.~~

## 1.1 Key findings

* Rainfall rose 12% year on year
* Sensor uptime reached 99.2%
* Two stations need new batteries
* Nested item under batteries

## 1.2 Next steps

1. Order batteries
2. Recalibrate sensors
3. Publish dataset

# 2. Measurements

|  |  |  |  |
| --- | --- | --- | --- |
| Station | Rainfall (mm) | Uptime | Notes |
| Alpha | 412.5 | 99.2% | Battery low |
| Bravo | 388.0 | 97.8% | OK | stable |
| Charlie | 451.3 | 99.9% | New sensor |

## 2.1 Chart

![](data:image/png;base64...)

Figure 1: Quarterly revenue chart.

### 3. Deep heading level three

Contact: hello@example.org — see https://example.org/data for the dataset. Unicode check: café, naïve, 東京, Ω, emoji 🙂.
synthetic_report.docx.md · 850 bytes output (.md)

What came across and what did not

5 headings → 4 kept, 1 changed · 1 paragraph → 1 kept · 2 lists → 2 kept · 1 table → 1 kept

Input · report.docx

Page image of report.docx, the input document

Output · markitdown report.docx

Pilot Report: Field Station Alpha
 
# 1. Summary
 
This report covers **three sites** during *spring 2026* <u>with underlined</u> ~~and struck text.~~
 
## 1.1 Key findings
 
* Rainfall rose 12% year on year
* Sensor uptime reached 99.2%
* Two stations need new batteries
* Nested item under batteries
 
## 1.2 Next steps
 
1. Order batteries
2. Recalibrate sensors
3. Publish dataset
 
# 2. Measurements
 
|  |  |  |  |
| --- | --- | --- | --- |
| Station | Rainfall (mm) | Uptime | Notes |
| Alpha | 412.5 | 99.2% | Battery low |
| Bravo | 388.0 | 97.8% | OK | stable |
| Charlie | 451.3 | 99.9% | New sensor |
 
## 2.1 Chart
 
![](data:image/png;base64...)
 
Figure 1: Quarterly revenue chart.
 
### 3. Deep heading level three
 
Contact: hello@example.org — see https://example.org/data for the dataset. Unicode check: café, naïve, 東京, Ω, emoji 🙂.
  1. changed heading becomes plain text: Pilot Report: Field Station Alpha
  2. kept heading: 1. Summary
  3. kept paragraph: This report covers three sites during sp
  4. kept heading: 1.1 Key findings
  5. kept list: Rainfall rose 12% year on year
  6. kept heading: 1.2 Next steps
  7. kept list: Order batteries
  8. kept heading: 2. Measurements
  9. kept table: Station
markitdown 0.1.9 · Linux (lab container) · 2026-11-15 · proof data

Kept: headings, bold and italic, both kinds of list, table cells and the link text. Changed in this file: the document's title became plain text rather than a heading; the table has an empty header row with the real header as its first row; a | inside a cell (OK | stable) is not escaped, which breaks that row; and the chart became a shortened image placeholder.

Step 4: Convert the same document as a PDF

Run it and compare

Command
markitdown pdf-text.pdf -o pdf-text.md
markitdown pdf-text.pdf
Pilot Report: Field Station Alpha

1. Summary
Rainfall across the three stations rose steadily through the spring. Sensors reported every ten
minutes and the readings were averaged per day. Rainfall across the three stations rose steadily
through the spring. Sensors reported every ten minutes and the readings were averaged per day.
Rainfall across the three stations rose steadily through the spring. Sensors reported every ten
minutes and the readings were averaged per day.

1.1 Key findings

Rainfall rose 12% year on year

Sensor uptime reached 99.2%

Two stations need new batteries

2. Measurements
Rainfall across the three stations rose steadily through the spring. Sensors reported every ten
minutes and the readings were averaged per day. Rainfall across the three stations rose steadily
through the spring. Sensors reported every ten minutes and the readings were averaged per day.

(cid:127)
(cid:127)
(cid:127)
synthetic_pdf-text.pdf.md · 926 bytes output (.md)

Why it is different

There are no # headings, the bullets turned into (cid:127) junk and the image is gone. A PDF stores positioned text, not "this is a heading", so the converter has to guess the structure. This is the page's main lesson: when you can, convert the original Word, Excel or PowerPoint file, not its PDF. Details and fixes: PDF page.

Step 5: Convert a spreadsheet

Command
markitdown workbook.xlsx -o workbook.md
markitdown workbook.xlsx
## Rainfall
| Station | Date | Rainfall (mm) | Cost | Share |
| --- | --- | --- | --- | --- |
| Alpha | 2026-03-01 | 412.5 | 1200.50 | 0.33 |
| Bravo | 2026-03-02 | 388.0 | 980.00 | 0.31 |
| Charlie | 2026-03-03 | 451.3 | 1410.25 | 0.36 |
| NaN | NaT | NaN | NaN | NaN |
| Total | NaT | 1251.8 | 3590.75 | NaN |

## Notes
| Merged header across three columns | Unnamed: 1 | Unnamed: 2 |
| --- | --- | --- |
| Key | Value | Comment |
| battery | low | NaN |
| NaN | NaN | NaN |
| sensor | new | pipe | inside |

## Empty
|
|  |
synthetic_workbook.xlsx.md · 526 bytes output (.md)

Each sheet becomes a ## section. Look for NaN and NaT where cells were empty, Unnamed: 1 where a header was merged, a date shown without its format, and a currency or percentage shown as a plain number. Spreadsheet page.

Step 6: Print, save, pipe

Three ways to get output

Leave off -o to print to the screen; use -o file.md to save; or pipe the output into another program. On Windows always use -o and never >:

Input from stdin

Command
cat report.docx | markitdown

MarkItDown recognised a Word file, a PDF and a CSV piped in without any hint. When it cannot, add -x .ext: CLI reference.

A web page

Command
markitdown https://example.com

Some sites refuse automated requests (Wikipedia answered 403); see web pages.

Step 7: The same in Python

Pythonapi-quickstart-loop.py
from pathlib import Path
from markitdown import MarkItDown

md = MarkItDown()                      # create the converter once and reuse it
for name in ("report.docx", "pdf-text.pdf", "workbook.xlsx"):
    result = md.convert(f"samples/{name}")              # convert a file
    out = Path(name).with_suffix(".md")
    out.write_text(result.markdown, encoding="utf-8")   # .markdown is the text
    print(f"{name:<14} -> {out}  {len(result.markdown):>5} characters, first line: {result.markdown.splitlines()[0]!r}")
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
report.docx    -> report.md    838 characters, first line: 'Pilot Report: Field Station Alpha'
pdf-text.pdf   -> pdf-text.md    926 characters, first line: 'Pilot Report: Field Station Alpha'
workbook.xlsx  -> workbook.md    526 characters, first line: '## Rainfall'

captured result

Create the converter once and reuse it. Errors and streams: Python API; whole folders: batch conversion.

How to judge any conversion

  1. Headings are present. If every line is the same size the structure was lost (PDF page).
  2. Tables are real tables, with the right header row (PDF, Excel).
  3. The reading order is right, especially in columns.
  4. Nothing important is missing: images, notes, comments (images, PowerPoint).
  5. No junk characters such as (cid:127) or ? (encoding).

Why Markdown for language models: our Word report needed 266 tokens as Markdown against 451 as HTML, and the workbook 209 against 708; plain extracted text is smaller still (191 and 133) but has no structure.

Markdown costs more than bare text and far less than HTML

Tokens for the same sample document in three forms (OpenAI cl100k_base, counted locally; o200k_base differs by under 4%)

  • Other form
  • MarkItDown
Markdown costs more than bare text and far less than HTML
ItemtokensNote
report.docx · raw extracted text191665 characters
report.docx · HTML4511165 characters
report.docx · MarkItDown Markdown266838 characters
pdf-text.pdf · raw extracted text189927 characters
pdf-text.pdf · HTML2671053 characters
pdf-text.pdf · MarkItDown Markdown188926 characters
workbook.xlsx · raw extracted text133291 characters
workbook.xlsx · HTML7081770 characters
workbook.xlsx · MarkItDown Markdown209526 characters

Test T22 · markitdown 0.1.9 · mammoth 1.13 for HTML, pdfminer.six for PDF text, openpyxl and pandas for the workbook · 2026-11-15 · token-counts.csv

Where to go next