pdftomarkdown
Convert PDFs, Word documents, Excel/CSV files, and YouTube videos into clean, structured Markdown for AI agents, LLMs, and knowledge tools.
README
📄 PDF to Markdown (PDF to MD) — Fast, Private, Open-Source Converter
The ultimate open-source PDF to Markdown converter for Humans, Developers, and AI Agents.
Effortlessly convert PDFs, Word (.docx), Excel & CSVs (.xlsx,.csv), and YouTube URLs into clean, structured, token-efficient Markdown (.md).
📑 Table of Contents
- Why PDF to Markdown?
- Architecture & Conversion Flow
- Key Features
- How to Use (3 Ways)
- Benchmark & Comparison Matrix
- Supported Formats
- CLI Reference & Options
- Programmatic API (Node / TypeScript)
- Technical SEO & Performance
- Frequently Asked Questions (FAQ)
- License
🎯 Why PDF to Markdown?
PDFs are designed for visual printing, not editing or AI computing. They trap content inside fixed-coordinate binary blobs. Markdown (.md) is the universal standard for:
- 🤖 AI & LLM Workflows: Maximizes prompt token density for Claude, ChatGPT, Cursor, and Gemini by stripping layout bloat.
- 🗂️ Knowledge Management: Effortless importing into Obsidian, Notion, Logseq, Roam, and Apple Notes.
- 📝 Technical Documentation: Direct ingestion into static site generators like Docusaurus, VitePress, MkDocs, and Astro.
- 🌿 Git Version Control: Clean line-by-line diffs instead of opaque binary changes.
🏗️ Architecture & Conversion Flow
INPUT SOURCE
┌──────────────────────────────┬──────────────────────────────┐
▼ ▼ ▼
📄 PDF Document 📝 Word / Excel 🎥 YouTube Link
(Local / Remote URL) (.docx, .xlsx, .csv) (Video URL / Shorts)
│ │ │
└──────────────────────────────┼──────────────────────────────┘
▼
┌──────────────────────────────────────┐
│ Unified Geometric & NLP Engine │
├──────────────────────────────────────┤
│ • Visual Reading Order Sorter │
│ • H1–H4 Typography Hierarchy │
│ • GFM Table Reconstructor │
│ • Code Block & List Parser │
│ • Link & Metadata Extractor │
└──────────────────────────────────────┘
│
▼
CLEAN MARKDOWN
┌──────────────────────────────┼──────────────────────────────┐
▼ ▼ ▼
🌐 Web UI Workspace 💻 CLI Output Stream 🤖 AI Agent Context
(Split Editor + Preview) (stdout / .md file export) (Claude / Cursor MCP)
✨ Key Features
- 🔒 100% In-Browser Privacy: In the web app, documents are converted locally in memory via WebAssembly / JavaScript. Zero files are uploaded to any external server.
- ⚡ Zero-Install CLI (
npx): Convert any PDF, Word doc, or CSV straight from your command line with no setup. - 📊 Smart Table Detection: Automatically aligns multi-column rows into clean GitHub Flavored Markdown (GFM) pipe tables (
| Header | ... |). - 🗂️ Multi-Format Extensibility: Converts PDFs, Word (
.docx), Excel/CSVs (.csv), and YouTube videos into Markdown. - 🤖 Native Model Context Protocol (MCP) Server: Connect directly to Claude Desktop, Cursor, Windsurf, and Antigravity with zero coding.
- 🎨 Minimalist Dual-Panel Workspace: Live side-by-side raw Markdown editor and rendered HTML preview with line, word, and character counters.
- 🚀 Blazing Fast: Converts standard multi-page documents in milliseconds without requiring heavy GPUs or multi-gigabyte models.
🚀 How to Use (3 Ways)
1. Live Web Application (Zero Install)
Visit pdftomarkdown.fyi:
- Drag and drop any PDF file.
- Click Convert to Markdown.
- Preview the rendered document side-by-side and click Copy Markdown or Download .md.
2. Zero-Install CLI (npx)
No installation required. Run directly in your terminal:
# Convert a local PDF file
npx pdftomarkdown research-paper.pdf -o paper.md
# Convert a Word document (.docx)
npx pdftomarkdown document.docx -o doc.md
# Convert a CSV table to GFM pipe tables
npx pdftomarkdown financials.csv -o financials.md
# Extract timestamped transcript from a YouTube video
npx pdftomarkdown "https://www.youtube.com/watch?v=dQw4w9WgXcQ" > video.md
# Convert with an automatic Table of Contents
npx pdftomarkdown manual.pdf --toc -o manual.md
# Pipe directly into an AI tool / LLM
cat quarterly-report.pdf | npx pdftomarkdown | llm "Summarize the key takeaways"
3. AI Agent & MCP Server (Claude / Cursor)
Equip your AI assistants with PDF to Markdown capabilities with zero coding.
Claude Desktop Configuration:
Add this entry to your claude_desktop_config.json:
{
"mcpServers": {
"pdftomarkdown": {
"command": "npx",
"args": ["-y", "pdftomarkdown", "--mcp"]
}
}
}
Now you can prompt Claude:
"Read
whitepaper.pdfand convert it to clean markdown with table of contents."
📊 Benchmark & Comparison Matrix
| Capability | pdftomarkdown | PSPDFKit | Marker | Microsoft MarkItDown |
|---|---|---|---|---|
| Instant Live Web App | ✅ Yes (pdftomarkdown.fyi) | ❌ No | ❌ No | ❌ No |
| 100% In-Browser Privacy | ✅ Yes (0 uploads) | ❌ No | ❌ No | ❌ No |
Zero-Install CLI (npx) |
✅ Yes | ✅ Yes | ❌ (Heavy Python) | ❌ (Python pip) |
| Live Rendered Preview | ✅ Yes (Side-by-side) | ❌ No | ❌ No | ❌ No |
Word (.docx) to MD |
✅ Yes | ❌ No | ❌ No | ✅ Yes |
| Excel / CSV to GFM Table | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| YouTube Video to Transcript | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| Model Context Protocol (MCP) | ✅ Yes (Built-in) | ⚠️ Partial | ❌ No | ⚠️ Python only |
| Execution Speed | ⚡ < 200 ms / page | ⚡ < 200 ms / page | 🐢 5–20 s (GPU) | ⚡ < 500 ms / page |
| Hardware Overhead | 🪶 Featherweight (JS) | 🪶 Featherweight | 🐘 Giant (10GB+ PyTorch) | 🐍 Python Env |
🗂️ Supported Formats
| Format | Extension | Output Style |
|---|---|---|
| PDF Documents | .pdf |
Headings (H1–H4), lists, GFM tables, links, code blocks |
| Word Documents | .docx |
Headings, bold/italic, bullet lists, clean links |
| Excel & CSV | .csv, .tsv, .xlsx |
GitHub Flavored Markdown (GFM) pipe tables |
| YouTube URLs | https://youtube.com/... |
Timestamped transcript (00:00), description, and metadata |
| Plain Text & Code | .txt, .json, .xml |
Formatted code fences & readable Markdown blocks |
🛠️ CLI Reference & Options
pdftomarkdown — The universal document to Markdown converter.
Usage:
npx pdftomarkdown <file-or-url> [options]
Options:
-o, --output <file> Write output directly to a file (.md)
--toc Automatically generate a Table of Contents
--no-tables Disable automatic GFM table detection
--mcp Start Model Context Protocol (MCP) server
-v, --version Show current version
-h, --help Show help documentation
💻 Programmatic API (Node / TypeScript)
You can import and use the converter directly inside your Node.js or TypeScript projects:
import { convertPdfToMarkdown, convertAnyToMarkdown } from 'pdftomarkdown';
// Convert a PDF buffer or file
const markdown = await convertPdfToMarkdown(pdfBuffer, {
includeToc: true,
detectTables: true,
preservePageBreaks: true,
});
console.log(markdown);
🔍 Technical SEO & Performance
- Primary Keywords: PDF to Markdown, PDF to MD, PDF to Markdown converter, convert PDF to Markdown.
- Secondary Keywords: PDF to Markdown online, free PDF to Markdown converter, convert PDF file to Markdown, extract Markdown from PDF, Word to Markdown, YouTube to Markdown.
- Technical Standards: Semantic HTML5, Schema.org
WebSite,WebApplication, andFAQPageJSON-LD schemas, sitemap.xml, robots.txt. - Zero Client Overhead: No heavy UI frameworks on the parser engine, optimized WebAssembly worker threads.
❓ Frequently Asked Questions (FAQ)
What is PDF to Markdown conversion?
PDF to Markdown conversion parses the geometry, fonts, and text positions inside fixed-layout PDF files and translates them into plain-text Markdown (.md) format, preserving headings, lists, tables, and links.
How do I convert PDF to Markdown for free?
You can use the live web app at pdftomarkdown.fyi or run npx pdftomarkdown input.pdf -o output.md in your terminal. Both are 100% free with no registration or subscriptions.
Is my document kept private?
Yes. When using the web app, all parsing occurs locally in your browser's memory. No files or text streams are ever sent to our servers.
Can I convert tables from PDF to Markdown?
Yes. Our engine detects horizontally and vertically aligned text columns and formats them into standard GitHub Flavored Markdown (GFM) pipe tables.
Can I use the output with ChatGPT, Claude, and LLMs?
Yes. Clean Markdown is the optimal input format for AI prompts and RAG vector databases, minimizing token usage while maintaining document hierarchy.
📄 License & Disclaimer
Distributed under the MIT License. See LICENSE for more information.
Disclaimer: All product names, logos, and brands (including Microsoft, PSPDFKit/Nutrient, Marker, Claude, and ChatGPT) are property of their respective owners and are used here solely for identification, compatibility, and comparative purposes.
Copyright © 2026 PDF to Markdown
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。