To convert Markdown to PDF, open your .md file in something that renders it and export the result: a browser preview, a VS Code extension, an online converter, Pandoc, or a hosted typesetting tool. All five turn an MD file into a PDF; they differ in how much control you get over the page, and the page is the whole problem.
Markdown has no concept of a page. It describes structure (this is a heading, this is a list) and says nothing about where paper ends. Every tool below is a different answer to that gap, so that is the axis worth comparing them on. If you are new to the syntax itself, the Markdown cheat sheet covers it first.
How do I convert a Markdown file to PDF?
The shortest version, whichever tool you use:
- Open the .md file in a tool that renders Markdown (a preview pane, an editor, a converter page).
- Check the rendered result: headings, lists, tables and images should look like the structure you wrote.
- Set the page, if the tool lets you: page size, margins, fonts, page numbers.
- Export or print to PDF, then open the file on another device to confirm the fonts and breaks held.
Step 3 is where the tools split. Here is what each route actually does, what it is good at, and what will eventually make you look for something else.
1. Print to PDF from a preview
Open your Markdown in any preview (a browser, an editor pane, a notes app) and print to PDF. It costs nothing and takes ten seconds.
Good for: a draft someone needs to read once. Internal notes. Anything where the file is a courier and nobody looks at it twice.
Where it stops: you are printing a web page, not making a book. The browser decides where pages break, and it decides badly: headings stranded at the bottom of a page, tables that lose their header row halfway down, an image torn across the fold. You get the browser's own header and footer unless you remember to turn them off. Margins are whatever the print dialog offers, and the typefaces are whatever the preview happened to use.
2. Can VS Code convert Markdown to PDF?
Yes, through an extension. Extensions such as Markdown PDF render your file through a headless browser and save the result as a PDF. This is a real step up from printing, because you can point them at a CSS file, so the type and spacing become yours rather than the default stylesheet's.
Good for: developers who are already in the editor, want repeatable output, and are comfortable writing CSS to get it. There is a longer walkthrough in writing a book in VS Code.
Where it stops: you are now maintaining a stylesheet for print, which is a different discipline from styling a screen. Page breaks, running headers, widow and orphan control and page numbering all live in CSS rules you have probably never needed before, and browser support for the print-specific ones is uneven. It works, and then a month later you are debugging why page-break-inside: avoid did nothing.
3. Is there a free Markdown to PDF converter online?
Yes, several. Paste Markdown into a box, get a PDF back: no install, no account, no learning curve. That is what a search for "md to pdf" usually wants, and for a one-off file it is a fair answer.
Good for: one file, once, when the look does not matter.
Where it stops: in three places. The output is generic: one default look, little or no control over type or margins. Some converters add their own branding to the file, which is fine for a memo and not fine for anything you intend to sell or hand to a client. And you are uploading a document to a service whose retention policy you have probably not read, which is worth a thought if the draft is not yours to leak.
If what you want is an online editor first and a PDF second, online Markdown editors compared sorts them by job.
4. How do I convert Markdown to PDF with Pandoc?
Pandoc is the serious command-line answer, and it deserves its reputation. Pointed at a LaTeX engine, it produces properly typeset pages, with the hyphenation and justification decisions that make a page look professionally set rather than merely tidy.
pandoc book.md -o book.pdf --pdf-engine=xelatexGood for: technical books, academic work, anything with heavy cross-referencing, citations or mathematics. If your document has a bibliography, this is the correct tool. Pandoc for books goes through the flags that matter.
Where it stops: the first command works. The second week is harder. Changing a typeface means learning fontspec. Changing margins means geometry. A cover image, a different look for chapter openings, or a running header with the chapter name means a custom template, which means learning enough LaTeX to debug someone else's. There is also no live preview: you compile, look, adjust and compile again, and the loop is slow enough that you stop adjusting long before the document is right.
5. A hosted typesetting tool
The last route is to hand the page problem to something built for it: you keep writing Markdown, and the pagination, font embedding and layout are handled, with the design exposed as a handful of controls rather than a configuration language.
This is what bukpress does. Type is three choices (title, subtitle, body), each with its own size and colour. The page is a paper texture or your own image, with margins in points and page numbers on or off. A line of --- is a hard page break, and a table that runs past the bottom of a page repeats its header row on the next. The preview paginates with the same rules the export uses, so a break on page seven on screen should land on page seven in the file, with the export as the final word.
Good for: anyone whose bottleneck is the design rather than the writing, and who wants the output to be defensible without becoming a typesetter to get there. Lifetime, $27 once, exports unlimited PDFs and EPUBs, books up to 500 pages, with no watermark.
Where it stops: it is opinionated. The page is A4, the export is PDF (and EPUB), and you get the controls a book needs rather than an arbitrary layout canvas: no text wrapping around a floated illustration, no multi-column spreads, no pinning an element to a spot on page four. If your document is really a designed artefact rather than a book or report, a layout application is still the right tool.
Markdown to PDF converters side by side
| VS Code | Online | Pandoc | Hosted | ||
|---|---|---|---|---|---|
| Setup | None | Minutes | None | Hours | None |
| Control over type | None | Via CSS | Little | Via LaTeX | Direct |
| Real page breaks | No | Fragile | Rarely | Yes | Yes |
| Fonts embedded | Sometimes | Yes | Varies | Yes | Yes |
| Live preview of pages | No | No | No | No | Yes |
| Covers | No | Manual | No | Template | Upload |
| Cost | Free | Free | Free or paid | Free | Free to preview, paid to export |
Which Markdown to PDF route should you pick?
Ask what happens to the file after you make it.
- Read once, then discarded: print to PDF and stop there.
- Regenerated constantly by a build: Pandoc, or a VS Code extension if the styling needs are light.
- Cited, with mathematics or a bibliography: Pandoc with LaTeX. This is not a close call.
- Sold, sent to a client, or printed: you need control over the page, and the choice is between learning a typesetting system and using one that has already been configured.
The mistake worth avoiding is the middle: three evenings fighting a print stylesheet for a document that needed to be finished on Tuesday. Pick by the document's destination, not by which tool you happened to open first.
Markdown to PDF questions
How do I force a page break in a Markdown PDF?
Standard Markdown has no page break. Most tools need raw HTML such as a div with page-break-after: always, or a LaTeX \newpage in Pandoc. In bukpress a line of --- on its own is a page break. Markdown page breaks covers every tool.
Why do my fonts change when someone else opens the PDF?
Because the fonts were not embedded. A PDF that references a font instead of carrying it falls back to whatever the reader's machine has. PDF font embedding explains how to check and fix it.
Can I convert MD to PDF on a phone?
An online converter works in a mobile browser for a quick file. For anything longer, a browser-based editor with export does the same job without a local install, because the render happens on the server.
Next step
If you want to see the far end of that spectrum before choosing, the sample book is eight pages exported from bukpress with nothing touched afterwards: page breaks, a real table, embedded type and the margins actually set. Open it, then try your own Markdown file in the editor, with a 7-day refund if it isn't for you.