Markdown to PDF Converter: 5 Free Ways to Export .md Files
Markdown to PDF Converter: 5 Free Ways to Export .md Files
Markdown is great for writing — plain text, version-controllable, readable in any editor. It's a much worse format for sharing. The moment you need to send a report to a client, submit a document for review, or archive something that won't drift if someone opens it in a different app, you need a PDF.
This is the reverse of what file2markdown normally does — our tool turns PDFs, Word docs, spreadsheets, and more into Markdown for AI pipelines and RAG workflows. But the question comes up constantly from the same audience: you've got AI-generated Markdown, Obsidian notes, or a README, and now you need a PDF out the other end. Here are five ways to do it, free, from fastest to most customizable.
1. Your Browser (Fastest, Zero Install)
If you just need a one-off PDF and don't care about pixel-perfect styling, open the Markdown file in any renderer that shows it as HTML — GitHub, a Markdown preview pane in VS Code, Obsidian's reading view — and print to PDF.
- Open the rendered Markdown view.
- Press
Ctrl+P/Cmd+P. - Choose "Save as PDF" as the destination.
This works everywhere, needs no install, and is good enough for internal sharing. It's a poor fit if you need consistent margins, a cover page, or batch conversion of dozens of files.
2. Pandoc (Best for Scripting and Batch Jobs)
Pandoc is the standard open-source document converter, and Markdown to PDF is one of its best-supported paths (unlike the reverse direction — see our Pandoc PDF-to-Markdown breakdown for where Pandoc struggles going the other way).
# macOS
brew install pandoc basictex
# Debian/Ubuntu
sudo apt install pandoc texlive-latex-base texlive-fonts-recommended
Then convert:
pandoc notes.md -o notes.pdf
Pandoc renders Markdown to PDF via LaTeX by default, which gives you clean typography and proper page breaks, but it needs a LaTeX distribution installed (that's what basictex / texlive are above — expect a multi-hundred-MB install). For simpler styling without LaTeX, point Pandoc at a PDF engine like wkhtmltopdf instead:
pandoc notes.md -o notes.pdf --pdf-engine=wkhtmltopdf
Pandoc is the right choice when you're converting many files in a script, a CI job, or a build pipeline — it's scriptable and handles front matter, footnotes, and citations well.
3. md-to-pdf (Node.js CLI, Good for Automation)
md-to-pdf is an open-source (MIT-licensed) npm package, currently at version 5.2.5, that renders Markdown through a headless Chrome instance (via Puppeteer) instead of LaTeX — so your output looks like a styled web page rather than a typeset academic paper.
npx md-to-pdf notes.md
That writes notes.pdf next to your source file. One catch worth knowing before you run it: since it renders via headless Chrome, the first run needs a Chrome/Chromium binary available to Puppeteer. If you see an error about Puppeteer being unable to find Chrome, run:
npx puppeteer browsers install chrome
first, then retry the conversion. This makes md-to-pdf a good fit for Node.js projects and CI pipelines where you're already comfortable managing npm dependencies, and you want CSS-based styling (you can pass a custom stylesheet) rather than LaTeX output.
4. VS Code "Markdown PDF" Extension (Best for Writers)
If you write Markdown in VS Code already, the Markdown PDF extension (free, currently version 2.2.0) adds export directly in the editor:
- Install the extension from the Extensions panel.
- Open your
.mdfile. - Press
F1(orCtrl+Shift+P/Cmd+Shift+P) to open the command palette. - Run
markdown-pdf: Export (pdf).
It renders the same way your Markdown preview pane looks, including code block syntax highlighting, and drops the PDF next to your source file. No command line needed — a good default if you want something that just works without touching a terminal.
5. Online Converters (Good for a One-Off, No Install)
If you don't want to install anything at all, browser-based converters that accept a .md upload and return a PDF exist (CloudConvert's Markdown-to-PDF tool is a common result for this). They're convenient for a single quick conversion. For anything recurring, or for documents containing sensitive content, prefer a local tool (options 1–4 above) — uploading files to a third party adds a dependency and a privacy tradeoff you don't need for something Pandoc or a browser can already do offline.
Going the Other Direction: PDF to Markdown
If your workflow runs the opposite way — you've got PDFs (reports, papers, scanned contracts) and need clean Markdown for an LLM, a RAG pipeline, or your Obsidian vault — that's a harder problem than Markdown-to-PDF, because you're recovering structure (headings, tables, lists) from a format that doesn't preserve it. That's what file2markdown is built for: upload a PDF, DOCX, XLSX, PPTX, or several other formats at file2markdown.ai/convert/pdf-to-markdown and get Markdown back, no install required. See our guide to picking a PDF-to-Markdown converter if you're comparing tools, or how we prep PDFs for RAG pipelines if the end goal is retrieval rather than just a readable file.
Choosing Between Them
| Method | Install needed | Best for |
|---|---|---|
| Browser print | None | One-off, internal sharing |
| Pandoc | LaTeX or wkhtmltopdf | Scripts, CI, batch jobs |
| md-to-pdf | Node.js + Chrome | Automation with CSS styling |
| VS Code extension | VS Code | Writers already in the editor |
| Online converter | None | Single quick conversion, non-sensitive content |
If you're converting documents into Markdown for an AI workflow and need help with the chunking step afterward, see our guide on chunking Markdown for vector databases. If you're pulling Markdown out of Notion, Confluence, or Google Docs first, we cover those conversions too: Notion to Markdown, Confluence to Markdown, Google Docs to Markdown.
Frequently Asked Questions
Can I convert Markdown to PDF without installing anything?
Yes — open the file in any Markdown renderer (GitHub, VS Code's built-in preview, Obsidian) and use your browser's "Print to PDF" option. It's the fastest zero-install path, though you get less control over styling than with Pandoc or a dedicated tool.
Why does Pandoc need LaTeX just to make a PDF?
Pandoc's default PDF engine renders through LaTeX, which is what gives it clean, print-quality typography and automatic page breaks. If you don't want the LaTeX install (it can be several hundred megabytes), tell Pandoc to use a lighter HTML-based engine instead with --pdf-engine=wkhtmltopdf.
Does Markdown to PDF preserve tables and code blocks?
Yes, with all the tools above — Pandoc, md-to-pdf, and the VS Code extension all render standard Markdown tables and fenced code blocks correctly, including syntax highlighting in the editor-based tools. Browser print-to-PDF preserves whatever the renderer already displays, so it depends on which app's preview you're printing from.
What's the best tool if I need to convert PDFs back to Markdown instead?
That's a different, harder problem, since the converter has to reconstruct structure that PDF doesn't explicitly store. file2markdown handles PDF, DOCX, XLSX, PPTX, HTML, EPUB, and more, with a free online converter and an MCP server for automating it from Claude, Cursor, and other AI agents.
The Markdown Memo
A fortnightly note for lawyers, researchers, accountants, and anyone else drowning in PDFs, scans, and decks. No spam.