MarkItDown CLI Usage Guide
MarkItDown is a command-line tool for converting many file and URL inputs into Markdown. It works well for PDFs, Office documents, HTML, feeds, archives, and several optional plugin-backed workflows.
Basic Usage
# Convert a file to stdout
markitdown document.pdf
# Save Markdown to a file
markitdown document.pdf > document.md
markitdown document.pdf -o document.md
# Convert a URL
markitdown https://example.com/report.pdf
markitdown https://example.com/article -o article.md
# Read from stdin with an explicit type hint
cat page.html | markitdown -x html
cat payload | markitdown -m text/html
Common CLI Flags
| Flag |
Description |
-o, --output FILE |
Write output to FILE instead of stdout |
-x, --extension EXT |
Hint the file extension, especially when using stdin |
-m, --mime-type MIME |
Hint the MIME type |
-c, --charset CHARSET |
Hint the character encoding |
-d, --use-docintel |
Use Azure Document Intelligence |
-e, --endpoint URL |
Azure Document Intelligence endpoint |
-p, --use-plugins |
Enable installed third-party plugins |
--list-plugins |
List installed plugins and exit |
-v, --version |
Show the installed version |
Supported Inputs
Typical direct inputs include:
- PDF, DOCX, PPTX, XLSX, XLS, EPUB, MSG
- HTML pages, feed URLs, and some specialized web handlers
- CSV, JSON, XML, plain text, and Markdown
- ZIP archives
- Images and audio when the required optional dependencies are installed
High-Frequency Patterns
Batch conversion
# Convert all DOCX files in the current directory
for f in *.docx; do
markitdown "$f" -o "${f%.docx}.md"
done
# Convert all XLSX files recursively
find . -name "*.xlsx" -exec sh -c 'markitdown "$1" -o "${1%.xlsx}.md"' _ {} \;
Piping and chaining
markitdown report.pdf | grep "revenue"
markitdown data.xlsx | head -50
curl -s https://example.com/page.html | markitdown -x html
Stdin hints
When the input comes from stdin, MarkItDown cannot reliably infer the format on its own. Add -x or -m:
cat mystery_file | markitdown -x pdf
cat spreadsheet.bin | markitdown -m application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
cat text_payload | markitdown -x csv -c UTF-8
Plugins, OCR, and Azure
- OCR should be treated as a plugin-backed capability rather than an official built-in extra documented here.
- If an OCR plugin is installed, discover it with
--list-plugins and enable it with --use-plugins.
- Azure Document Intelligence is a first-class path for complex scanned documents. Use
-d -e.
- In Xpert's MarkItDown middleware, the relevant official extras are values such as
all, pdf, docx, pptx, xlsx, xls, outlook, az-doc-intel, audio-transcription, and youtube-transcription.
# Discover installed plugins
markitdown --list-plugins
# Use installed plugins, for example an OCR plugin
markitdown --use-plugins scanned.pdf -o scanned.md
# Use Azure Document Intelligence
markitdown -d -e "https://your-resource.cognitiveservices.azure.com/" complex.pdf -o complex.md
Format-Specific Notes
- PDF: Text PDFs usually work directly. For scanned PDFs, prefer Azure Document Intelligence or an installed OCR plugin.
- DOCX / PPTX / XLSX: Good defaults for headings, lists, slides, and tables, but review the output for complex layouts.
- HTML / URL: Works best when the content is either a file path or a fetchable URL. For stdin, add
-x html or -m text/html.
- Images: Core behavior is often metadata-oriented. OCR or richer extraction usually depends on installed plugins or additional services.
- Audio: Requires optional dependencies such as
audio-transcription or all.
Troubleshooting
- Empty output from stdin: add
-x or -m so MarkItDown knows the input type.
- Scanned PDF is missing text: use
-d -e for Azure Document Intelligence, or enable the installed OCR plugin with --use-plugins.
- A format is unsupported: verify the input really matches the hinted type and that the relevant optional dependencies are installed.
- Output is very large: save it with
-o or > first, then inspect the result with other shell tools.
1---2name: markitdown-cli3description: Use this skill when the user wants to convert documents, URLs, or typed stdin content to Markdown with the markitdown CLI. It covers local files, URLs, format hints for stdin, batch conversion, third-party plugins, and Azure Document Intelligence workflows.4---56# MarkItDown CLI Usage Guide78MarkItDown is a command-line tool for converting many file and URL inputs into Markdown. It works well for PDFs, Office documents, HTML, feeds, archives, and several optional plugin-backed workflows.910## Basic Usage1112```bash13# Convert a file to stdout14markitdown document.pdf1516# Save Markdown to a file17markitdown document.pdf > document.md18markitdown document.pdf -o document.md1920# Convert a URL21markitdown https://example.com/report.pdf22markitdown https://example.com/article -o article.md2324# Read from stdin with an explicit type hint25cat page.html | markitdown -x html26cat payload | markitdown -m text/html27```2829## Common CLI Flags3031| Flag | Description |32|------|-------------|33| `-o, --output FILE` | Write output to `FILE` instead of stdout |34| `-x, --extension EXT` | Hint the file extension, especially when using stdin |35| `-m, --mime-type MIME` | Hint the MIME type |36| `-c, --charset CHARSET` | Hint the character encoding |37| `-d, --use-docintel` | Use Azure Document Intelligence |38| `-e, --endpoint URL` | Azure Document Intelligence endpoint |39| `-p, --use-plugins` | Enable installed third-party plugins |40| `--list-plugins` | List installed plugins and exit |41| `-v, --version` | Show the installed version |4243## Supported Inputs4445Typical direct inputs include:4647- PDF, DOCX, PPTX, XLSX, XLS, EPUB, MSG48- HTML pages, feed URLs, and some specialized web handlers49- CSV, JSON, XML, plain text, and Markdown50- ZIP archives51- Images and audio when the required optional dependencies are installed5253## High-Frequency Patterns5455### Batch conversion5657```bash58# Convert all DOCX files in the current directory59for f in *.docx; do60 markitdown "$f" -o "${f%.docx}.md"61done6263# Convert all XLSX files recursively64find . -name "*.xlsx" -exec sh -c 'markitdown "$1" -o "${1%.xlsx}.md"' _ {} \;65```6667### Piping and chaining6869```bash70markitdown report.pdf | grep "revenue"71markitdown data.xlsx | head -5072curl -s https://example.com/page.html | markitdown -x html73```7475### Stdin hints7677When the input comes from stdin, MarkItDown cannot reliably infer the format on its own. Add `-x` or `-m`:7879```bash80cat mystery_file | markitdown -x pdf81cat spreadsheet.bin | markitdown -m application/vnd.openxmlformats-officedocument.spreadsheetml.sheet82cat text_payload | markitdown -x csv -c UTF-883```8485## Plugins, OCR, and Azure8687- OCR should be treated as a plugin-backed capability rather than an official built-in extra documented here.88- If an OCR plugin is installed, discover it with `--list-plugins` and enable it with `--use-plugins`.89- Azure Document Intelligence is a first-class path for complex scanned documents. Use `-d -e`.90- In Xpert's MarkItDown middleware, the relevant official extras are values such as `all`, `pdf`, `docx`, `pptx`, `xlsx`, `xls`, `outlook`, `az-doc-intel`, `audio-transcription`, and `youtube-transcription`.9192```bash93# Discover installed plugins94markitdown --list-plugins9596# Use installed plugins, for example an OCR plugin97markitdown --use-plugins scanned.pdf -o scanned.md9899# Use Azure Document Intelligence100markitdown -d -e "https://your-resource.cognitiveservices.azure.com/" complex.pdf -o complex.md101```102103## Format-Specific Notes104105- **PDF**: Text PDFs usually work directly. For scanned PDFs, prefer Azure Document Intelligence or an installed OCR plugin.106- **DOCX / PPTX / XLSX**: Good defaults for headings, lists, slides, and tables, but review the output for complex layouts.107- **HTML / URL**: Works best when the content is either a file path or a fetchable URL. For stdin, add `-x html` or `-m text/html`.108- **Images**: Core behavior is often metadata-oriented. OCR or richer extraction usually depends on installed plugins or additional services.109- **Audio**: Requires optional dependencies such as `audio-transcription` or `all`.110111## Troubleshooting112113- **Empty output from stdin**: add `-x` or `-m` so MarkItDown knows the input type.114- **Scanned PDF is missing text**: use `-d -e` for Azure Document Intelligence, or enable the installed OCR plugin with `--use-plugins`.115- **A format is unsupported**: verify the input really matches the hinted type and that the relevant optional dependencies are installed.116- **Output is very large**: save it with `-o` or `>` first, then inspect the result with other shell tools.