How to Convert Markdown to PDF
Markdown is great for writing: clean syntax, easy to read, works everywhere. But when you need to share a document with someone who does not use Markdown (most people), a PDF is the universal format. A browser-based Markdown-to-PDF converter handles the entire job locally without uploading your content to any server.
Why convert Markdown to PDF
- Sharing documents: PDFs look the same on every device. Markdown files require a renderer.
- Printing: Markdown does not have a concept of page size or margins. PDF handles print layout properly.
- Professional appearance: a PDF with proper heading styles, margins, and page breaks looks more polished than a raw Markdown file.
- Submissions: many workplaces, schools, and clients expect PDF format.
- Archival: PDF/A is an ISO-standardized long-term storage format. Markdown is not.
- Email attachments: PDFs render reliably in every email client. Markdown shows up as raw text in most.
- Legal and audit trails: a signed PDF is recognized in most jurisdictions; a Markdown file is not.
How to convert Markdown to PDF
- Paste your Markdown: enter or paste your content into the editor. The right panel shows a live preview of how it will look.
- Customize page settings: select the page size (A4, Letter, A3, A5) and adjust margins to match your needs.
- Generate and download: click "Generate PDF" to create the document, then download it instantly.
A brief history of Markdown
Markdown was created by John Gruber in 2004, with significant input from Aaron Swartz. Gruber's goal was a writing-friendly syntax that could be read as-is and rendered to HTML, replacing the messy HTML that most people had to write directly. The original spec was intentionally minimal: headers, bold, italic, links, lists, blockquotes, code.
The format went viral. By 2010, Stack Overflow, GitHub, Reddit, and most developer-focused sites had adopted Markdown. CommonMark (2014) standardized the syntax to fix ambiguities in Gruber's original spec. GitHub Flavored Markdown (GFM) added tables, task lists, strikethrough, and other features that the original Markdown lacked.
Today, Markdown is the lingua franca for technical writing: README files on GitHub, documentation sites (Docusaurus, MkDocs, VuePress), blogs (Hugo, Jekyll, Eleventy, Astro), note-taking apps (Obsidian, Notion, Bear), and chat tools (Discord, Slack, Element). The combination of human-readable source and reliable HTML/PDF rendering is why it has not been displaced by anything newer.
Markdown syntax quick reference
| Syntax | Result |
|---|---|
# Heading 1 |
Large heading |
## Heading 2 |
Medium heading |
**bold** |
bold |
*italic* |
italic |
[text](url) |
Clickable link |
`code` |
Inline code |
- item |
Bullet list |
1. item |
Numbered list |
> quote |
Blockquote |
--- |
Horizontal rule |
 |
Image |
``` |
Multi-line code block |
| ` | col1 |
- [ ] task |
Task list checkbox (GFM) |
~~text~~ |
Strikethrough (GFM) |
What you can create
- Technical documentation: API references, internal wiki pages, runbooks, project READMEs printed as deliverables
- Reports and case studies: research with embedded code blocks, tables, and diagrams
- Resumes and CVs: a clean text-driven format that exports to professional PDF
- Academic papers and notes: lecture notes, study guides, draft chapters
- Business documents: meeting minutes, proposals, change-of-process documentation
- Books and ebooks: many authors draft long-form content in Markdown and export to PDF for review
- Recipe books, study guides, journals: anything where structure matters but you do not want to fight a word processor
Markdown flavors
Different parsers implement slightly different Markdown rules:
- CommonMark: the standardized core. Headers, bold, italic, links, lists, code blocks, blockquotes.
- GitHub Flavored Markdown (GFM): adds tables, task lists, strikethrough, autolinks, raw HTML support. The most widely deployed flavor.
- MultiMarkdown / Pandoc Markdown: adds footnotes, citations, math (LaTeX-style), definition lists, metadata blocks. Used in academic and book contexts.
- AsciiDoc: a separate format with more features (admonitions, includes, conditional content). Different syntax; not Markdown but often compared.
- MDX: Markdown + JSX for React components. Web-only; does not render to PDF cleanly.
Most browser-based Markdown-to-PDF converters use GFM or CommonMark. If you write with footnote/citation syntax, verify your converter supports it before generating.
Styling the output
Markdown is plain text; the PDF needs styling decisions:
- Font choice: most converters default to a sans-serif (Helvetica, Arial) for body and a monospace (Courier, Menlo) for code. Some allow custom font choices.
- Code highlighting: syntax highlighting in code blocks (using libraries like Prism.js or highlight.js) makes code more readable. Enable this if your document has lots of code.
- Table styling: default tables are simple. Some converters offer striped rows or borders for clarity.
- Heading hierarchy: H1 should be your document title (one per document); H2 for major sections; H3-H6 for subsections. Skipping levels (H1 → H4) confuses screen readers and table-of-contents generators.
- Page margins: 20-25mm margins are standard for documents. 15mm for posters and dense layouts. Margins below 10mm look cramped.
Common pitfalls
- Code blocks overflowing the page: very long lines wrap or get cut off. Either break long lines or use a smaller code font.
- Images not appearing: external images must be at accessible URLs. Use base64 data URIs (
) or relative paths if your converter supports them. - Tables breaking across pages: a long table may split mid-row. Most converters cannot insert "repeating headers" automatically. Workaround: break the table into smaller tables manually.
- Hard-coded line breaks not preserving: a single newline in Markdown is not a line break; you need two trailing spaces or a blank line. This is a frequent source of "my paragraphs got mashed together" issues.
- Headings not numbered: Markdown does not auto-number headings. If your document needs "1.1.1" style numbering, you must add it manually or use a converter that supports counters.
- Math equations not rendering: standard Markdown does not include math. If you write
$E = mc^2$expecting LaTeX rendering, you need a converter with KaTeX or MathJax support. - Special characters in URLs: spaces in image filenames break references unless URL-encoded (
my%20image.pngnotmy image.png).
Alternatives to consider
- Browser print-to-PDF: open the rendered Markdown in your browser (any preview tool), Ctrl/Cmd+P, save as PDF. Free, instant, but limited styling.
- Pandoc: the command-line workhorse for converting between Markdown, PDF, DOCX, EPUB, LaTeX. More features (citations, templates, math), but requires installation.
- Typora: a paid desktop Markdown editor with high-quality PDF export. Best when you write Markdown daily.
- Marp: Markdown for presentations. Exports to PDF as slides.
- Eleventy/Hugo/Jekyll + a PDF plugin: for static-site authors who want PDF versions of their articles automatically generated.
For one-off documents and most authoring, a browser-based converter is fastest. For repeated use in a writing workflow, Pandoc or Typora is worth setting up.
Tips
- Preview before generating: check the live preview to make sure headings, lists, and code blocks look right before creating the PDF.
- Use headings for structure: headings create a clear document hierarchy in the PDF. Use
#for the title,##for sections, and###for subsections. - Add page breaks: if you need to force a new page, you can use inline HTML:
<div style="page-break-after: always"></div>. - Keep code blocks short: very long code blocks may overflow the page width in the PDF. Break them into smaller chunks if needed.
- Test with A4 and Letter: if your document might be printed in different countries, check that it looks good on both A4 (used internationally) and US Letter (used in North America).
- Use a Markdown linter: tools like
markdownlintcatch formatting inconsistencies (trailing spaces, mixed list markers) that show up as visual glitches in the PDF. Free as a CLI tool or VS Code extension. - Match the platform's flavor: if your audience reads on GitHub, use GFM features (task lists, tables). If you publish via Pandoc, you can use footnotes and citations.
Privacy and confidential documents
The Markdown-to-PDF converter runs entirely in your browser. The Markdown source you paste, the generated HTML preview, and the final PDF all stay on your device. Nothing is uploaded to a server, logged, or shared with anyone.
This matters because Markdown documents often contain confidential content: technical specifications under NDA, internal documentation, drafts of unpublished writing, research notes with personal observations, financial reports in technical format. Cloud Markdown-to-PDF services by design send your content to their server. Some retain inputs for "improvement" or analytics. For sensitive Markdown content, a browser-based converter is the safer choice.
Browser-based conversion also works offline once the page is loaded, which is useful when traveling or working on a plane.
Frequently Asked Questions
Does the converter support all Markdown syntax?
Yes, including headers, bold, italic, links, images, code blocks, tables, lists, and blockquotes. Inline HTML is also supported.
Can I customize the page layout?
Yes. Choose from A4, US Letter, A3, or A5 page sizes and adjust margins from 0 to 50 millimeters.
Is my Markdown uploaded to a server?
No. The conversion happens entirely in your browser. Your content never leaves your device.
Can I include images in the PDF?
Yes, if the images are referenced by URL in your Markdown. Inline images and linked images both render in the PDF output.