Convert Markdown to Word, HTML or PDF with pandoc

Turn Markdown files into DOCX, HTML, PDF and more with pandoc — the universal document converter for writers and developers.

LinuxconversiondocumentmarkdownpandocLow risk
Run pandoc README.md -o README.docx to convert Markdown to Word (use -o out.pdf for PDF, which needs LaTeX installed).

01Command

Command
$ pandoc README.md -o README.docx

02What it does

Pandoc reads one markup format and writes another — Markdown, HTML, LaTeX, DOCX, ODT, EPUB, reStructuredText and dozens more — inferring formats from file extensions, or forcing them with -f and -t. For DOCX output that matches your corporate template, pass --reference-doc=template.docx; for PDF you need a LaTeX backend installed. Tables, footnotes, code blocks, and YAML metadata all survive conversion, which makes it the standard glue for keeping docs in git and publishing them elsewhere.

03Risk

RiskLow risk
Requirementspandoc (sudo apt install pandoc / sudo dnf install pandoc); for PDF output also a LaTeX engine (texlive)
!Warning: Complex Word documents with tracked changes, exotic styling, or nested text boxes do not survive a round-trip losslessly — check the output before replacing the original.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Pandoc User's Guide
    Pandoc · vendor-doc · 2026-09-17
    Evidence: Official manual covering -f/-t formats, -o output, and conversion between dozens of markup formats.
  • pandoc(1) — Debian manual page
    Debian · community · 2026-09-17
    Evidence: Reference for pandoc options including -f/-t formats, -o output, and --reference-doc for docx styling.

Last verified: 2026-09-18 · Category: Developer