Skip to main content

Free Tool

Markdown to PDF Converter

Paste Markdown or open a .md file and save it as a PDF. The text stays selectable and the links stay clickable, because your browser lays it out instead of taking a picture of it. Nothing is uploaded.

Real text, not an image

You can search it, copy from it, and click its links. Small files, sharp at any zoom.

Page breaks that work

<!-- pagebreak -->, Pandoc's \newpage, or \pagebreak. Front matter is kept off the page.

Stays on your device

No upload, no signup, no watermark. It works offline once the page has loaded.

Converter

An example document is loaded. Replace it, or open your own .md file.

PDF preview

Nothing is uploaded. In the print dialog choose Save as PDF, and untick Headers and footers to keep the date and page URL off the PDF.

Why the text in this PDF is real text

There are two ways to make a PDF in a web page. One draws the rendered page onto a canvas and wraps that image in a PDF. It is easy to build, and it is why some converters hand back a file you cannot search, where the links do nothing and the text blurs when you zoom. The other hands the page to the browser's print engine, the same one behind Ctrl+P, which writes actual text and live links into the PDF. This tool uses the second, which is also why the last step is your browser's print dialog rather than a download button.

The Markdown is rendered as GitHub Flavored Markdown, the same way the Markdown viewer renders a README, so tables, task lists, and fenced code blocks all come through. Code blocks keep their shading even when the print dialog's background graphics option is off, and the print styles ask the browser to keep each heading with the paragraph after it rather than stranding it at the bottom of a page.

How to add a page break in Markdown

Markdown has no page break syntax, because it was designed for the web, where there are no pages. Each PDF tool invented its own, which is why advice on this conflicts. These three are the ones in real use, and this converter accepts all of them. Put the marker on a line by itself:

## Chapter one

The end of chapter one.

<!-- pagebreak -->

## Chapter two
Page break syntaxes and where each works
MarkerComes fromElsewhere it is
<!-- pagebreak -->Browser-based convertersAn HTML comment: invisible on GitHub and in every renderer
\newpagePandoc (LaTeX)Printed literally as the text “newpage”
\pagebreakPandoc (LaTeX)Printed literally as the text “pagebreak”

If the file will also be read on GitHub or in an editor, use the HTML comment: it is the only one that disappears everywhere else. Inside a fenced code block none of them is treated as a break, so a document that explains page breaks still prints its examples. The Markdown comments guide covers why the HTML comment form stays hidden.

Front matter is kept off the page

Notes from Obsidian, Jekyll, Hugo, and most static site generators start with a YAML block between two --- lines. A plain Markdown renderer does not know what that is, and turns it into a horizontal rule followed by a large heading that reads title: My Note. This converter removes the block and uses its title as the document title instead.

Removing the date and URL from the PDF

Browsers print a header and footer of their own by default: the date, the page title, the URL, and a page count. They are not part of your document and they are off by a single checkbox in the print dialog.

  • Chrome and Edge: More settings, then untick Headers and footers.
  • Firefox: More settings, then untick Print headers and footers.
  • Safari: Show Details if the dialog is collapsed, then untick Print headers and footers.

The page size and margins chosen above are set in the document itself, so Chrome, Edge, and Firefox open the dialog with them already selected.

Other ways to convert Markdown to PDF

A browser tool is the fastest route for one document. For a folder of files, a build step, or images stored next to the Markdown, a local tool is the better fit.

Pandoc

Best typography, needs LaTeX
pandoc notes.md -o notes.pdf --pdf-engine=xelatex

Pandoc goes through LaTeX by default, which is a multi-gigabyte install. Use xelatex rather than the default pdflatex if the document has non-Latin text or you want system fonts. --pdf-engine=weasyprint skips LaTeX and goes through HTML and CSS instead.

md-to-pdf (Node)

Batch jobs and CI
npx md-to-pdf notes.md

Writes notes.pdf next to the source. It drives headless Chromium through Puppeteer, so the first run downloads a browser. Good for converting a folder of files from a script.

Python

Already in a Python pipeline
python -m markdown notes.md > notes.html
weasyprint notes.html notes.pdf

pip install markdown weasyprint first. The HTML step has no styling, so pass a stylesheet to WeasyPrint with -s style.css if the default serif look is not what you want.

VS Code

The file is already open in an editor
Ctrl+Shift+P → Markdown PDF: Export (pdf)

Needs the Markdown PDF extension (yzane.markdown-pdf). The PDF lands next to the .md file, and relative images work because it runs from the file's folder.

Obsidian and Typora

Your notes live there
Obsidian: ⋯ menu → Export to PDF
Typora: File → Export → PDF

Both export the note as they render it, including their own theme. Obsidian's dialog has page size, margins and a downscale option.

Going the other way? The PDF to Markdown converter pulls the text back out of a PDF as Markdown.

Frequently asked questions

How do I view Markdown as a PDF?
Paste the Markdown or open the .md file in the converter above. The right-hand pane shows it laid out on paper, and Save as PDF opens your browser's print dialog with Save as PDF as the destination. Nothing is installed and the file is not uploaded.
How do I add a page break in Markdown for a PDF?
Markdown has no page break syntax of its own. Put <!-- pagebreak --> on a line by itself, which is an HTML comment and stays invisible everywhere else. This converter also accepts \newpage and \pagebreak, the spellings Pandoc uses, so a file written for Pandoc converts unchanged.
How do I convert Markdown to PDF with images?
Images with a full URL (https://...) appear in the PDF. Images with a relative path such as ./diagram.png do not, because a browser tool only receives the text of the .md file, not the folder around it. Swap relative paths for hosted URLs, or use VS Code or Pandoc from the folder that holds the images.
How do I convert Markdown to PDF in Python?
The shortest route is two command-line tools: python -m markdown notes.md > notes.html turns the Markdown into HTML with the Python-Markdown package, and weasyprint notes.html notes.pdf turns that HTML into a PDF. Both install with pip. pypandoc is the alternative if Pandoc is already installed.
Why does my PDF have the date and a URL at the top and bottom?
That is the browser's own header and footer, not part of your document. In the print dialog, open More settings and untick Headers and footers in Chrome or Edge, or untick Print headers and footers in Firefox and Safari.
Can I convert Markdown to PDF in VS Code?
Not natively. VS Code previews Markdown but has no PDF export. The usual extension is Markdown PDF by yzane: install it, open the .md file, and run Markdown PDF: Export (pdf) from the command palette. It renders through a bundled Chromium, so the output is close to this tool's.
Is my Markdown uploaded anywhere?
No. Rendering happens in your browser and the PDF is produced by your browser's print engine. The text is never sent to a server, which is why the converter keeps working with your network disconnected.