All free tools

Markdown to PDF converter

Paste Markdown or open a .md file, and get it back as a PDF.

Page size
Options
Result
Your PDF will appear here.

PDFs made here carry a small "Created via PDFShift" badge.

Markdown has no pages. It knows headings, lists, tables and code, and nothing about paper size, page breaks, page numbers or where to find an image. A PDF gets those from the step after Markdown: the HTML your Markdown is turned into, and the print settings. This converter shows you that step.

What Markdown can't say, and where you set it

What the PDF needsWhere it's decided
Paper sizeformat in the API call, the Page size buttons here. A4 unless you pick another.
Orientationlandscape, the Landscape box.
A page breakA <div style="break-after: page"></div> line in your Markdown, with an empty line above and below it.
Page numbersThe API's footer, with {{page}} and {{total}} where the numbers go. The Page numbers box adds one.
ImagesA full https:// address in the Markdown.
Fonts, colors and spacingThe stylesheet in the HTML document.

The sample in the box has one break line, so it comes out as two pages, with "Page 1 of 2" and "Page 2 of 2" at the bottom.

Page 1
Page 2

Page 1 of the sample weekly report as a PDF: the title, a summary line, a five-row table of PDFs per day, a list of changes, a task list with one item ticked and a quote, with Page 1 of 2 centered at the bottom.

Page 2 of the same PDF: the heading The call we make and a JSON code block on a gray background, with Page 2 of 2 at the bottom.

The sample report from the converter, made with an API key.

The PDF is printed on our server, which can't see your disk, so ![logo](./images/logo.png) prints as a broken-image icon with its alt text. The same image at https://pdfshift.io/images/logo.png prints.

The page break line and a full image address in a Markdown fileA Markdown editor with six numbered lines. Line 3 is a div with style break-after: page, marked "Page 2 starts here". Line 5 is an image with a relative path, ./images/logo.png, marked "Broken icon in the PDF". Line 6 is the same image at https://pdfshift.io/images/logo.png, marked "Prints".report.md123456> We'll watch it.## The call we make<div style="break-after: page"></div>![logo](./images/logo.png)![logo](https://pdfshift.io/images/…)Page 2 starts hereBroken icon in the PDFPrints
Two lines Markdown can't do on its own: the page break, and an image our server can fetch.

The HTML your Markdown becomes

The HTML tab above shows the exact document we send. Your browser turns the Markdown into HTML with marked, using GitHub Flavored Markdown, so tables, task lists and fenced code blocks come through. It wraps that in a full HTML document with a print stylesheet, then sends it to the PDFShift API with no key. Our Chromium prints it and the PDF comes back in the response. We don't keep a copy.

To change how it looks, copy the HTML, edit the stylesheet at the top and send it from your code. The HTML viewer shows the result at A4 width before you spend a conversion.

From your code or your agent

It's the same two steps: Markdown to HTML with your language's library, then one call. In Node:

import { marked } from 'marked'
import { writeFile } from 'node:fs/promises'

const markdown = '# Weekly report\n\n| Day | PDFs |\n|---|---:|\n| Monday | 412 |'
const html = `<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>${marked.parse(markdown)}</body></html>`

const response = await fetch('https://api.pdfshift.io/v3/convert/pdf', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.PDFSHIFT_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    source: html,
    footer: { source: '<div style="font-size:9px;text-align:center;width:100%">Page {{page}} of {{total}}</div>' }
  })
})
await writeFile('report.pdf', Buffer.from(await response.arrayBuffer()))

Send a full document that starts with <!DOCTYPE html>, not just the fragment marked returns. In Python, the markdown package does the first step, and the Python HTML to PDF guide covers the call. The Node guide has more on the request.

AI agents write their answers and reports in Markdown already. Have the agent convert it to HTML and call PDFShift, directly or through our MCP server, and the report lands as a PDF without a browser on your side.

For PDFs your app or agent makes on demand, PDFShift is one HTTP call, and we run the Chromium behind it. We've run PDFShift since 2018, and we hold 4.8 stars from 65 reviews on Capterra. Create a free account to get your key.

Frequently asked questions

How can I convert a Markdown file to a PDF for free?

Open it in the converter on this page and press Convert to PDF. No account needed. You get 10 conversions a day, each up to 2 MB and 30 seconds, and every page carries a small Created via PDFShift badge. From your own code, the free plan gives you 50 credits a month with no credit card.

What is the best Markdown to PDF converter?

One that shows you what sits between your Markdown and the PDF, the HTML and the print settings, and lets you change both. This page does that for one file. The PDFShift API takes the same HTML and settings for every PDF your app or your agent makes, and prints them the same way every time.

How can I convert a Markdown file to PDF on Windows?

In your browser, on this page. Click Open a .md file, pick the file and convert. Nothing to install, and it works the same on Windows, Mac and Linux.

Does it render math or Mermaid diagrams?

No. The converter turns Markdown into plain HTML, so a math or mermaid block prints as code. Turn the diagram or formula into an SVG or PNG first and add it as an image with a full https:// address.