Markdown to Word: 3 ways to get a clean .docx

The most reliable way to convert Markdown to Word is Pandoc: run pandoc draft.md -o draft.docx, and add --reference-doc to apply your own Word styles. Without the command line, open the .md file in Google Docs and download it as a Word file. Either way, headings, lists, links and tables come across as real Word styles; page breaks and custom layout usually need fixing in Word.

You wrote it in Markdown because it's faster. Then the editor, the client or the publisher asks for a Word file, with tracked changes on. Copying the rendered text into Word loses the heading styles, and pasting the raw file leaves asterisks everywhere.

There are three good routes, and the right one depends on how often you'll do it.

Which method should you use?

MethodBest forStyles controlSetup
PandocAnything long, or a conversion you'll repeatFull, via a reference documentInstall once, one command
Google DocsOne-off conversions, no installGoogle's defaultsNone
Online convertersA short file, quicklyLittleNone

If the document is a book or a long report, or you'll send revisions, use Pandoc. If it's a two-page brief, Google Docs is fine.

How do you convert Markdown to Word with Pandoc?

  1. Install Pandoc from pandoc.org. It runs on Windows, macOS and Linux.
  2. Convert the file. In a terminal, in the folder with your file:
pandoc draft.md -o draft.docx
  1. Open it in Word. Markdown headings become Word's Heading 1, Heading 2 and so on, so the Navigation pane and an automatic table of contents work straight away.
  2. Apply your own styles (optional). Make a copy of the output, change its styles in Word (fonts, sizes, spacing), save it as reference.docx, then convert with:
pandoc draft.md --reference-doc=reference.docx -o draft.docx

Every later conversion picks up those styles, so you set the look once. Several files can go into one document in order: pandoc 01.md 02.md 03.md -o book.docx. Pandoc for books covers the rest of what it does.

How do you convert Markdown to Word with Google Docs?

  1. In Google Docs, go to File > Open > Upload and pick your .md file. It opens as a formatted document.
  2. Check the headings and lists.
  3. Go to File > Download > Microsoft Word (.docx).

Google added Markdown import and export to Docs in 2024. There is nothing to install. The trade-off is styling: you get Google's defaults, and there is no reusable style template like Pandoc's reference document.

Online converters work the same way: upload, download. Read their privacy terms before you upload an unpublished manuscript.

What breaks when you convert Markdown to Word?

ElementWhat happensFix
Headings, bold, italic, listsConvert cleanly to Word stylesNone needed
LinksBecome clickable Word linksNone needed
TablesConvert, with basic stylingRestyle in Word, or set the table style in the reference doc
ImagesEmbedded if the path resolvesUse paths relative to the Markdown file
Page breaksUsually lostInsert them in Word, or style headings to start on a new page
FootnotesPandoc converts [^1] to real Word footnotesOther converters may print them as text
Raw HTMLMostly droppedRemove it before converting

The biggest gap is the page. Markdown has no page model, so the Word file has no layout decisions in it: page size, margins and headers are whatever Word defaults to. Set those in the reference document once.

Do you need Word at all?

Often the Word file is a waypoint: the editor reviews it with tracked changes, you accept the edits, and the final version still has to become a PDF or an ebook. If so, two habits save work:

  • Keep the Markdown as the master copy. After the edit, bring the changes back with Word to Markdown instead of continuing in Word.
  • Make the final file from the Markdown. bukpress turns the Markdown into a typeset A4 PDF, and on Pro into an EPUB, with the fonts, margins and page breaks set by rules rather than by hand.

To be clear: bukpress does not export Word files. When a .docx is the deliverable, Pandoc is the better tool. When the deliverable is a PDF and Word was only the plan for getting there, you can skip the conversion.

Common questions

Can Word open a Markdown file?

Not as a formatted document: you get the raw text with its symbols. Convert it first with Pandoc or Google Docs.

Is there a Pandoc alternative without the command line?

Google Docs import works for single files. Some editors, such as Typora and VS Code extensions, export to Word, and many call Pandoc behind the scenes.

How do I keep my Word styles when converting from Markdown?

Use Pandoc's --reference-doc option with a Word file whose styles you've set. The converted file uses those styles.

Can I convert Markdown to Word with track changes?

No converter adds tracked changes. Convert the file, then turn on Track Changes in Word before the editor starts.

Read next

Tools · 4 min read

Word to Markdown: converting a manuscript cleanly

Pandoc converts a .docx to Markdown in one command and gets the structure right about 90 percent of the time. The remaining 10 percent is the part that matters: direct formatting that was never a real heading, smart quotes, tracked changes, embedded images and Word's own list numbering. Budget an hour of cleanup, once, and you never do it again.

Read it
Tools · 4 min read

Pandoc for books: what it is superb at, and where it stops

Pandoc is the best tool available for documents with citations, cross-references or mathematics, and for any book whose production is automated by a build. It stops being the pragmatic choice when your requirements are visual rather than structural, because every visual change is made by writing LaTeX or a template.

Read it
Explainers · 4 min read

Google Docs, Word or Markdown: what to write a book in

Write in Google Docs if other people need to comment on the draft while you write it, in Word if an editor or publisher will hand you tracked changes, and in Markdown if the same manuscript has to become several finished formats without being reformatted each time. Most people who finish books use two of the three, in sequence.

Read it

Write it in Markdown. Ship a book.

bukpress turns the file you are already writing into a typeset PDF and EPUB: your type, your covers, no watermark on any plan.

Start free, no card required