# MarkItDown File to Markdown Converter (`devil_port369-owner/microsoft-markitdown-converter`) Actor

Convert PDF, Word (DOCX), Excel, PowerPoint, HTML and more to clean Markdown with Microsoft MarkItDown. Built for LLM ingestion, RAG pipelines, and bulk document preprocessing — no local install.

- **URL**: https://apify.com/devil\_port369-owner/microsoft-markitdown-converter.md
- **Developed by:** [DataFusionX](https://apify.com/devil_port369-owner) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.02 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## MarkItDown File to Markdown Converter

**Convert PDF, DOCX, PPTX, XLSX, HTML and more to clean Markdown** using [Microsoft MarkItDown](https://github.com/microsoft/markitdown). Built for **LLM ingestion**, **RAG pipelines**, and bulk document preprocessing on Apify — no local install.

[![MarkItDown](https://img.shields.io/badge/Powered%20by-Microsoft%20MarkItDown-blue)](https://github.com/microsoft/markitdown)
[![Apify](https://img.shields.io/badge/Apify-Actor-green)](https://apify.com)

***

### What does this Actor do?

This Actor wraps **Microsoft MarkItDown** (the open-source tool behind high-volume searches for *markitdown*, *markitdown github*, *microsoft markitdown*) into a production API on Apify.

You pass **file URLs** (or document links). The Actor:

1. Downloads each file safely
2. Converts it to **structured Markdown** (headings, lists, tables, links)
3. Optionally cleans HTML docs (nav/sidebar removed)
4. Pushes results to the dataset and optionally stores full `.md` in the key-value store

Perfect when you need **PDF to Markdown**, **DOCX to Markdown**, or Office → Markdown for AI systems.

***

### Why Markdown for LLMs and RAG?

- LLMs understand Markdown natively and use fewer tokens than raw HTML/PDF text
- Headings and tables improve chunking and retrieval quality
- One format for mixed corpora (PDF + Word + slides + sheets)

Use this Actor as the **preprocessing step** before embeddings, vector DBs, Copilot grounding, or agent tools.

***

### Supported formats

| Type | Formats |
|------|---------|
| Documents | **PDF**, **Word (DOCX)**, **PowerPoint (PPTX)**, **Excel (XLSX/XLS)** |
| Web | **HTML** (with optional main-content cleanup) |
| Data | CSV, JSON, XML, TXT |
| Media | Images (metadata / optional LLM captions), audio (transcription extras via MarkItDown) |
| Other | EPUB, ZIP (iterates contents), YouTube URLs (via MarkItDown) |

Powered by **Microsoft MarkItDown** — the same library used widely for LLM and RAG document pipelines.

***

### Input

| Field | Type | Description |
|-------|------|-------------|
| `fileUrls` | array of strings | HTTP(S) URLs of files or pages to convert |
| `maxFileSizeMb` | integer | Max download size (default 50) |
| `cleanHtml` | boolean | Extract main article from HTML; drop nav/sidebar (default true) |
| `enableImageCaptions` | boolean | Optional LLM captions for images/slides |
| `openaiApiKey` | secret string | Only if image captions are enabled |
| `llmModel` | string | e.g. `gpt-4o` |
| `storeMarkdownInKeyValue` | boolean | Also save full Markdown in KV store |

#### Example input

```json
{
  "fileUrls": [
    "https://example.com/report.pdf",
    "https://example.com/policy.docx",
    "https://docs.example.com/guide"
  ],
  "maxFileSizeMb": 50,
  "cleanHtml": true,
  "storeMarkdownInKeyValue": true
}
```

***

### Output

One dataset row per file:

```json
{
  "type": "document",
  "ok": true,
  "sourceUrl": "https://example.com/report.pdf",
  "fileName": "report.pdf",
  "format": "pdf",
  "contentType": "application/pdf",
  "title": "Q3 Report",
  "markdown": "# Q3 Report\n\n...",
  "charCount": 15230,
  "error": null,
  "scrapedAt": "2026-08-29T14:00:00+00:00"
}
```

- **`markdown`** — clean Markdown ready for RAG / LLM context
- **Key-value** (optional) — full `.md` under keys like `markdown-0-report.pdf`

***

### Primary use cases

| Use case | How this Actor helps |
|----------|----------------------|
| **RAG preprocessing** | PDF / DOCX / PPTX → Markdown → chunk → embed |
| **LLM context / prompts** | Feed models structured text instead of binary files |
| **AI agents** | Tool step: “given URL, return Markdown” |
| **Knowledge bases** | Bulk convert SharePoint / Drive style links to MD |
| **Docs migration** | HTML or Office → Markdown for docs-as-code |
| **MarkItDown without ops** | Same Microsoft MarkItDown quality, hosted on Apify |

***

### How it works (technical)

1. Downloads each URL to a temporary file (size-capped)
2. For HTML: extracts main content (e.g. article / `theme-doc-markdown`), strips chrome
3. Runs **MarkItDown `convert_local()`** only (safe; no arbitrary remote convert)
4. Normalizes Markdown (code fences, relative links, noise lines, base64 image strip)
5. Charges PPE event `file-converted` on success

Security-minded: user URLs are not passed into a permissive multi-source `convert()`; files are fetched then converted locally.

***

### Pricing (PPE)

| Event | When |
|-------|------|
| `file-converted` | Each **successful** file conversion |

Failed downloads or conversions are not charged. Configure price per event in Apify Console.

***

### FAQ

**Is this the official Microsoft product?**\
No. It uses the open-source [Microsoft MarkItDown](https://github.com/microsoft/markitdown) library (MIT) packaged as an Apify Actor for batch API use.

**PDF to Markdown quality?**\
Strong on digital text PDFs and Office files. Scanned or complex layout PDFs may need OCR / Azure options later; HTML pages benefit from `cleanHtml`.

**DOCX / PPTX / XLSX to Markdown?**\
Yes — core MarkItDown converters for Word, PowerPoint, and Excel.

**Can I use it for RAG and LLM pipelines?**\
Yes. That is the main design goal: structured Markdown for retrieval and model context.

**MarkItDown MCP?**\
This Actor is the **HTTP/batch** equivalent for pipelines and automation (Make, n8n, LangChain, custom agents). For local MCP, see Microsoft’s `markitdown-mcp` package; for cloud batch conversion, use this Actor.

**File size limits?**\
Controlled by `maxFileSizeMb` (default 50). Raise memory for very large PDFs.

***

### Keywords

MarkItDown · Microsoft MarkItDown · markitdown github · PDF to Markdown · DOCX to Markdown · PPTX to Markdown · Excel to Markdown · HTML to Markdown · LLM preprocessing · RAG document converter · MarkItDown MCP alternative (batch) · Office to Markdown · AI document ingestion

# Actor input Schema

## `fileUrls` (type: `array`):

HTTP(S) URLs of documents (PDF, DOCX, PPTX, XLSX, HTML, images, audio, EPUB, ZIP, …).

## `maxFileSizeMb` (type: `integer`):

Skip files larger than this.

## `cleanHtml` (type: `boolean`):

Extract main article from HTML; fall back to full page if extraction is too short.

## `enableImageCaptions` (type: `boolean`):

Describe images/slides via LLM (needs API key).

## `openaiApiKey` (type: `string`):

Optional. Prefer env OPENAI\_API\_KEY / secret.

## `llmModel` (type: `string`):

Vision model for captions (e.g. gpt-4o).

## `storeMarkdownInKeyValue` (type: `boolean`):

Save each full markdown under markdown-{index}-…

## Actor input object example

```json
{
  "fileUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "maxFileSizeMb": 50,
  "cleanHtml": true,
  "enableImageCaptions": false,
  "llmModel": "gpt-4o",
  "storeMarkdownInKeyValue": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "fileUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("devil_port369-owner/microsoft-markitdown-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "fileUrls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("devil_port369-owner/microsoft-markitdown-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "fileUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call devil_port369-owner/microsoft-markitdown-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devil_port369-owner/microsoft-markitdown-converter"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NZoEUL3EsYv5txNj8/builds/WeDLor0uG6KVJYF1S/openapi.json
