PDF Tools

Markdown to PDF Converter

Convert Markdown to PDF instantly in your browser. No upload, no account, no limits.

Loading tool...

Complete Guide to Converting Markdown to PDF Online

Markdown is the fastest way to write structured documents, but PDF is still the format teams share, print, and sign. This tool converts Markdown to PDF entirely in your browser — live preview, correct math, highlighted code, and no upload.

The converter supports the full GitHub Flavored Markdown spec plus KaTeX math and highlight.js syntax highlighting. The PDF export isolates your document in a hidden iframe so the editor UI never appears in the output.

Because nothing is sent to a server, it works for private notes, internal engineering docs, and anything else you need to keep on-device.

How to Convert Markdown to PDF

Paste or upload your Markdown using the editor on the left. The preview panel updates in real time as you type. Select your paper size (A4, Letter, or Legal) from the selector — the preview reflows to show exact pagination for that size.

When the layout looks right, click Export PDF. The converter creates a hidden print frame, injects your document with the correct CSS, waits for images and KaTeX fonts to load, and opens the browser print dialog. Choose 'Save as PDF' to download.

Math, Code, and GFM: What Renders Correctly

Math equations use KaTeX for both inline (`$E = mc^2$`) and block (`$$\int_0^1 x^2\,dx$$`) math. KaTeX renders HTML with precise font metrics, producing typeset equations identical to GitHub's math display — but now in a portable PDF.

Code blocks use highlight.js with language autodetection. TypeScript, Python, Go, Rust, Java, SQL, Bash, YAML, JSON, and 170+ other languages are highlighted. Color is preserved in the PDF via `print-color-adjust: exact`. Code blocks are protected from mid-block page breaks with `break-inside: avoid`.

GitHub Flavored Markdown features — task lists with rendered checkboxes, pipe tables with alignment, strikethrough, and autolinks — all render correctly in both preview and PDF.

  • A4: 20 mm margins, 794 px preview width.
  • Letter: 1 in margins, 816 px preview width.
  • Legal: 1 in margins, 816 px preview width — useful for wide tables.
  • Images, code blocks, tables, and rows are protected against awkward page breaks.

Privacy, Security, and Sanitization

All rendering, sanitization, and export run locally in your browser. Your Markdown text is never transmitted to ShellPDFs or any third-party server. This makes the tool suitable for internal documentation, proprietary code samples, and any content you need to keep private.

The rendered HTML is sanitized with DOMPurify before it reaches the preview or print frame. Script tags, event handlers, unsafe link protocols, and non-image data URLs are stripped. External links receive `rel="noopener noreferrer nofollow"`. Embedded images are validated to allow only HTTPS URLs and base64 image data.

Large Documents and Performance

Documents under 1 MB render on the main thread with a 300 ms debounce. Documents over 1 MB automatically offload rendering to a Web Worker to keep the editor responsive. A 15-second timeout prevents hung renders from blocking the UI.

For documents with many embedded base64 images, the total Markdown string can grow quickly. A 2 MB embedded image adds roughly 2.7 MB to the content after base64 encoding. For large image-heavy documents, referencing images by HTTPS URL keeps the editor fast.

How It Works

Step 1

Paste Markdown, upload a .md file, or write a document from scratch in the editor.

Step 2

Preview renders in real time — choose A4, Letter, or Legal to see exact pagination.

Step 3

Export a clean PDF via the isolated print engine, or download a standalone HTML file.

Why This Tool

  • 100% browser-based — your Markdown never leaves your device.
  • Live rendered preview: GFM tables, task lists, KaTeX math, and syntax-highlighted code.
  • PDF export isolates your document in a hidden iframe — app UI never bleeds into output.
  • Standalone HTML export for offline viewing with the same print-ready CSS.
  • Choose A4, Letter, or Legal paper size with real-time preview reflow.
  • Embed local images as base64 data URLs — no external host needed.

Use Cases

  • Converting README files into polished PDFs for clients or stakeholders.
  • Exporting engineering specs and architecture docs with code blocks and equations.
  • Saving product specs, onboarding guides, and meeting notes as print-ready PDFs.
  • Generating handouts from technical presentations written in Markdown.
  • Exporting internal documentation that must stay off cloud servers.

Frequently Asked Questions

Common questions about the Markdown to PDF tool — how it works, privacy, file limits, and more.

No. Rendering, sanitization, HTML export, and PDF print preparation all happen locally in your browser using JavaScript. ShellPDFs never receives your Markdown content.
Full GitHub Flavored Markdown: headings, bold, italic, strikethrough, blockquotes, ordered and unordered lists, task lists, fenced code blocks with syntax highlighting, pipe tables, horizontal rules, inline math ($...$), block math ($$...$$), and images from secure URLs or embedded base64 data URLs.
ShellPDFs creates a hidden iframe containing only the sanitized rendered document, injects page-size-specific print CSS and the KaTeX stylesheet, waits for images and fonts to load, then calls print on that isolated frame. The editor, toolbar, and sidebar are never part of the printable output.
A4 (210×297 mm, 20 mm margins), Letter (8.5×11 in, 1 in margins), and Legal (8.5×14 in, 1 in margins). The preview reflows to the selected size in real time so you can check pagination before exporting.
Yes. Inline math ($E = mc^2$) and block math ($$\int_0^1 x^2\,dx$$) are rendered with KaTeX, producing accurate typeset equations in both the live preview and the exported PDF. KaTeX supports fractions, integrals, summations, Greek letters, matrices, and most common LaTeX math syntax.
Fenced code blocks with a language identifier (```ts, ```python, etc.) are highlighted using highlight.js, which supports 180+ languages. Color highlighting is preserved in the printed PDF via print-color-adjust: exact — it does not fall back to black-and-white.
Yes. Click 'Embed Image' to convert a local image file to a base64 data URL and insert the Markdown image tag at the cursor position. The image stays in the editor as part of the Markdown string — nothing is uploaded.
Yes. 'Export HTML' downloads a fully self-contained HTML file with all CSS inlined. It renders identically to the preview when opened in any browser, and the @page rules ensure it prints correctly too.

Need a walkthrough before you start?

We publish first-party guides for the workflows people actually use, and we explain how those articles are tested, reviewed, and updated.

Privacy, file deletion, and support

Browser-based tools never upload your file. Server-assisted tools run in isolated workers with short-lived storage and deletion rules documented in our public policies.

Explore More Tools