Guide

How to Convert Markdown to PDF on Linux

Updated June 1, 2026

On Linux you have three reliable ways to convert Markdown to PDF: a free browser tool with no install, Pandoc plus a TeX Live engine, or VS Code with an extension. The browser tool is the fastest for a one-off; Pandoc is the most powerful for scripting and academic work. Here is how each works.

Option 1: A browser tool (easiest)

The quickest option is MarkdownToFile.com, which runs entirely client-side in your browser. No account, no upload — the conversion happens locally, which matters if the document is sensitive.

  1. Open the editor in Firefox, Chrome, or Chromium.
  2. Paste or type your Markdown. The paginated preview is the exact document you download.
  3. Pick a theme, page size (A4, Letter, Legal, A3), and margins.
  4. Download a real vector PDF with selectable text and clean page breaks.

It supports GitHub-Flavored Markdown, GFM tables, Mermaid diagrams, KaTeX math, task lists, footnotes, and highlighted code. It does not export .docx directly — Copy HTML and paste into LibreOffice or Google Docs for an editable file. As an interactive tool, it is not meant for batch jobs across many files.

Option 2: Pandoc (apt / dnf + texlive)

Pandoc is the standard for automated, repeatable conversions and scholarly documents. Install it from your package manager along with a TeX Live engine for PDF rendering.

# Debian / Ubuntu
sudo apt install pandoc texlive-latex-recommended texlive-fonts-recommended

# Fedora
sudo dnf install pandoc texlive-scheme-basic

pandoc input.md -o output.pdf

The texlive packages provide the LaTeX engine Pandoc uses to build PDFs; a fuller TeX Live install can be several GB. Once set up, you get templates, BibTeX citation processing, and easy scripting into pipelines or CI. The downside is a learning curve and no WYSIWYG preview.

Option 3: VS Code

If you live in VS Code, the Markdown PDF extension (by yzane) keeps everything in the editor.

  1. Open Extensions, search “Markdown PDF”, and install.
  2. On first export it downloads a Chromium build automatically.
  3. Open your .md file and run Markdown PDF: Export (pdf) from the command palette.

Styling is via CSS, and Mermaid or KaTeX need extra configuration. Convenient if VS Code is already open, but heavier than a browser tool for one file.

Comparison: effort vs power

MethodSetup effortPower / flexibilityBest for
Browser toolNoneThemes, Mermaid, KaTeX, A4/Letter/Legal/A3Quick, private, one-off PDFs
Pandoc + texliveHigh (TeX Live install)Very high (templates, citations, scripting)Automation, academic docs
VS Code extensionMediumMedium (CSS styling)People already living in VS Code

Bottom line

For a fast, private conversion without touching your package manager, the browser tool is the easiest route on Linux. Pick Pandoc when you need automation, custom templates, or citations; pick VS Code if that is already your workflow. On another OS? See Convert Markdown to PDF on Mac or on Windows.

Open the editor and convert your Markdown to PDF now.

Written by Markdown to PDF Editorial Team

Our team specializes in document design, web standards, and developer utilities. This guide was researched and vetted against current browser printing standards and Paged.js specifications. Learn more on our About page.

Try it yourself — free, no signup

Convert your Markdown to a polished PDF right in your browser.

Open the editor