The most reliable way to convert Markdown to Word is Pandoc: install it, then run pandoc input.md -o output.docx and open the result in Microsoft Word. Pandoc turns headings into Word heading styles, lists into real lists and pipe tables into real tables, and a reference document lets you control fonts and spacing.
Key takeaways
- One command produces a .docx from a .md file.
- Use a reference document to apply your own fonts, margins and heading styles.
- Add a table of contents, numbered sections and metadata with command-line options or YAML.
- Images embed when their paths resolve, so run Pandoc from the right folder.
What You Need Before You Start
Pandoc is a free, open-source document converter that runs on Windows, macOS and Linux. Download the installer from pandoc.org/installing.html and follow the instructions for your system. Afterward, open a terminal (Command Prompt, PowerShell or Terminal) and check the install:
pandoc --version
You do not need Microsoft Word to create the file, but you will want Word, LibreOffice or Google Docs to open and review it. If you prefer to finish in the cloud, our guide to converting Markdown to Google Docs shows how to open the DOCX there.
Convert Markdown to Word Step by Step
- Save your text as
report.mdin a folder you can find easily. - Open a terminal and move into that folder with
cd. - Run the conversion command below.
- Open
report.docxin Word and check headings, lists, tables and images. - Save a copy under a new name before you start editing.
pandoc report.md -o report.docx
Pandoc picks the input and output formats from the file extensions. If you want to be explicit, write pandoc -f markdown -t docx report.md -o report.docx.

Add Metadata, a Table of Contents and Numbering
Pandoc reads a YAML block at the top of your Markdown file and uses it for the title page fields:
---
title: Quarterly Report
author: Jordan Lee
date: 2026-03-01
---
# Summary
Text starts here.
Several options change the output without editing the source:
| Option | What it does |
|---|---|
--toc |
Inserts a table of contents |
--toc-depth=2 |
Limits the contents to two heading levels |
--number-sections |
Numbers headings automatically |
--highlight-style=tango |
Colors fenced code blocks with a built-in theme |
A full run might look like this:
pandoc report.md --toc --toc-depth=2 --number-sections -o report.docx
Style the Document With a Reference File
The default look is plain. To match a company template, create a reference document and edit its styles in Word. Generate the starting file with:
pandoc -o custom-reference.docx --print-default-data-file reference.docx
Open custom-reference.docx, then change the styles named Normal, Heading 1, Heading 2, Title, Table and others. Do not worry about the sample text; only the styles matter. Save the file and use it in your command:
pandoc report.md --reference-doc=custom-reference.docx -o report.docx
Keep this reference file in your project so teammates get identical output. The options are described in the Pandoc User’s Guide.
Images, Tables and Code Blocks
Images in Markdown such as  are embedded in the Word file when Pandoc can find them, so run the command from the folder that makes the relative path valid. You can add --resource-path=.:images to tell Pandoc where to search.
Pipe tables become Word tables. They are simple by design: one line per row and no merged cells. If you are unsure how to build them, see our guide to Markdown table syntax. Fenced code blocks are exported in a monospace style, and adding a language name after the opening fence enables syntax coloring.

Convert Many Files at Once
Once the single-file command works, you can reuse it for a whole folder. On macOS and Linux, a short shell loop handles every Markdown file in the current directory:
for f in *.md; do pandoc "$f" -o "${f%.md}.docx"; done
On Windows PowerShell, the equivalent is a loop over Get-ChildItem *.md that calls Pandoc for each file. Batch conversion is one of the strongest arguments for Pandoc over online tools, which usually handle one file at a time. If you are weighing the options, read our comparison of Pandoc and online Markdown converters.
Whatever you choose, keep the original Markdown file as your source of truth. Edit the text there, regenerate the DOCX, and you avoid the trap of two diverging versions.
Fix Common Problems
- Lists run together: add a blank line before the first item of a list.
- Missing images: check the path, file name capitalization and spaces.
- Odd characters: save the Markdown file as UTF-8.
- File will not save: close the DOCX in Word before running Pandoc again, because Word locks open files.
Frequently Asked Questions
Do I need Microsoft Word installed?
No. Pandoc writes the .docx file itself. You only need a word processor to open it afterward.
Can Pandoc convert Word back to Markdown?
Yes. Run pandoc -f docx -t gfm report.docx -o report.md. Our article on converting Word to Markdown covers the details.
How do I change the font?
Edit the styles in a reference document and pass it with --reference-doc. Changing the font in the finished DOCX works too, but it does not repeat automatically.
Does Pandoc support footnotes?
Yes. Pandoc’s Markdown supports footnotes with [^1] markers, and they appear as Word footnotes.
Why does my document look plain?
Without a reference file, Pandoc uses its default styles. Create a reference document to apply a custom look.
Wrap-Up
Pandoc makes Markdown to DOCX conversion a single command, and a reference document gives you a repeatable house style. Start with the basic command, add a contents list and numbering if the document is long, and review images and tables before you send the file.



