Skip to main content
MarkItDown provides a powerful command-line interface for converting various file formats to Markdown.

Basic Usage

Convert a file to Markdown and output to stdout:

Input Methods

MarkItDown supports multiple ways to provide input:
When reading from stdin (pipe or redirection), you may need to provide hints about the file type using --extension or --mime-type flags.

Output Options

Control where the Markdown output is written:

Command-Line Flags

Version Information

Displays the version number and exits.

File Type Hints

When reading from stdin or when the file type cannot be automatically detected:
Provide a hint about the file extension. The leading dot is optional.
Provide a hint about the MIME type.
Provide a hint about the character encoding.

Azure Document Intelligence

Use Azure Document Intelligence for cloud-based conversion:
Document Intelligence requires:
  • A valid Azure endpoint URL (required)
  • Authentication via AZURE_API_KEY environment variable or Azure credentials
  • A file path (stdin is not supported with Document Intelligence)

Plugin Support

Enable third-party plugins:
List installed plugins:
Output shows:
Find plugins by searching for the hashtag #markitdown-plugin on GitHub.

Data URI Handling

By default, data URIs (like base64-encoded images) are truncated in the output:
Keeps full data URIs in the output, which can significantly increase file size.

Common Patterns

Batch Conversion

Convert multiple files:

Piping with Processing

Combine with other tools:

Using with stdin Hints

When the file type cannot be inferred from context:

Exit Codes

  • 0: Successful conversion
  • 1: Error occurred (file not found, conversion failed, invalid arguments, etc.)

Examples by File Type

1

PDF Documents

2

Word Documents

3

Excel Spreadsheets

4

PowerPoint Presentations

5

Images with Metadata

Troubleshooting

Encoding Issues

If you see garbled characters, try specifying the charset:

File Type Not Detected

Provide explicit hints:

Missing Dependencies

If conversion fails due to missing dependencies, install the appropriate optional dependencies:
See the Optional Dependencies guide for details.