Skip to content
FeaturesPricingBlogDownload

← All posts

How to convert Word to Markdown with images and tables

Convert Word to Markdown with one Pandoc command that keeps images, then fix what breaks: comments, tracked changes, complex tables and image tags.

A person sorting printed pages into a folder at a desk

To convert Word to Markdown, run Pandoc on the .docx file: pandoc input.docx -t gfm -o output.md --extract-media=media writes GitHub Flavored Markdown and saves the document's images in a media folder. Headings, bold and italic text, lists, links, footnotes and simple tables convert cleanly. Comments are dropped, tracked changes are accepted by default, and tables with merged cells or lists inside cells come out as HTML that you may want to simplify by hand.

The Pandoc details below are from the Pandoc manual (checked November 2026) and from our own test runs with Pandoc 3.9. If the result is your first .md file, the .md file page explains what is inside one.

Can Word save a document as Markdown?

Not according to Microsoft's documentation. Microsoft's page on file formats for saving documents lists 18 formats, including .docx, .rtf, plain text, web page and PDF, and Markdown is not one of them (checked November 2026).

The closest built-in options both lose something:

  • Plain Text (.txt) keeps the words and drops every heading, list and link.
  • Web Page (.htm) keeps the structure as HTML, which Pandoc can convert too, but Word adds a lot of styling markup. Converting the .docx directly gives cleaner results.

If your copy of Word shows a Markdown option that page doesn't list, try it on a copy of the document and compare the output with the Pandoc result below.

How do you convert a .docx file with Pandoc?

Install Pandoc, open a terminal in the folder that holds the document, and run one command. Pandoc reads the input format from the .docx extension, so you only name the output format.

  1. Install Pandoc. The installing page offers a package installer for Windows and macOS, and on a Mac with Homebrew you can run brew install pandoc (checked November 2026).

  2. Check it works by running pandoc --version.

  3. Open a terminal in the document's folder. On a Mac, open Terminal, type cd and a space, drag the folder into the window, and press Return. On Windows, open the folder in File Explorer, type cmd in the address bar, and press Enter.

  4. Run the conversion:

    pandoc input.docx -t gfm -o output.md --extract-media=media
    
  5. Open output.md in a Markdown editor and compare it with the original.

What each part does:

Part Meaning
input.docx The Word file to convert
-t gfm Write GitHub Flavored Markdown, which includes tables and task lists
-o output.md The file to create
--extract-media=media Save images to a media folder and point the Markdown at those files

Two optional flags help with longer documents:

  • --wrap=none keeps each paragraph on one line. By default Pandoc wraps output lines at 72 columns, which is harmless but makes edits harder to compare.
  • --track-changes=accept|reject|all controls tracked changes, covered below.

What converts cleanly, and what breaks?

Text structure converts well when the Word document used real styles. Comments, tracked changes, complex tables and anything tied to page layout need attention.

In Word In the Markdown file
Heading 1 to Heading 6 styles # to ###### headings
Text that only looks like a heading (bigger, bold) A bold paragraph, not a heading
Bold, italic, links, bulleted and numbered lists Standard Markdown
Footnotes Markdown footnotes ([^1])
Simple tables Pipe tables
Tables with lists or several paragraphs in a cell An HTML <table> block
Images Files in media/ and an HTML <img> tag
Comments Dropped, by default
Tracked changes Accepted, by default
Headers, footers, columns, page breaks No Markdown equivalent

Headings. Pandoc recognizes headings by their Word style. If someone formatted headings by making text large and bold, the converted file will have bold paragraphs where you expect ##. Apply Heading styles in Word before converting, or fix the lines afterward.

Complex tables. The manual says pipe table cells "cannot contain block elements like paragraphs and lists," and GFM tables have no syntax for merged cells. In our test, a table with a bulleted list inside a cell came out as an HTML <table>. That is valid in a .md file, but hard to edit. Flatten the table in Word first (one value per cell), or rebuild it as a pipe table afterward. The Markdown tables page shows the syntax.

Comments and tracked changes. The manual describes three settings for Word's Track Changes. accept, the default, applies all insertions and deletions. reject ignores them. Both ignore comments. all keeps insertions, deletions and comments, wrapped in spans that mark each one, which is useful for scripts but noisy to read. For a clean result, resolve comments and accept or reject changes in Word, save, then convert.

Images. With --extract-media=media, Pandoc saves each image and links to it. In our test the files landed one level deeper, in media/media/, and because Word stores an image's display size, Pandoc wrote an HTML <img> tag instead of ![alt](path). If you want plain Markdown image syntax, add -raw_html to the output format:

pandoc input.docx -t gfm-raw_html -o output.md --extract-media=media

That setting has a cost: in the same test, the complex table above was replaced by the text [TABLE]. Use it only on documents without complex tables, or convert twice and copy the tables from the first result. Without --extract-media at all, the Markdown points at image files that were never saved.

How do you convert many Word files at once?

Run Pandoc once per file with a short script. Pandoc converts one document per command, so a loop does the repetition.

Save this as convert.py in the folder with the .docx files, then run python3 convert.py (or python convert.py on Windows):

import pathlib
import subprocess

for docx in sorted(pathlib.Path(".").glob("*.docx")):
    md = docx.with_suffix(".md")
    subprocess.run(
        ["pandoc", str(docx), "-t", "gfm", "--wrap=none",
         "--extract-media=media/" + docx.stem, "-o", str(md)],
        check=True,
    )
    print("wrote", md)

Each document gets its own image folder under media/, so images from different files with the same name don't overwrite each other.

Can you convert by copying and pasting instead?

Yes, for one document at a time. When you copy from Word, the clipboard carries the formatting, and Markdown editors that convert pasted formatting turn it into Markdown headings, lists, links and tables.

  1. Open the document in Word and select the text (Cmd+A on a Mac, Ctrl+A on Windows).
  2. Copy it.
  3. Paste into an editor that converts rich text to Markdown.
  4. Check the headings and tables, as you would after a Pandoc run.

Copying is quick for a page or two. Use Pandoc when the document has images you want saved as files, when you need to control tracked changes, or when there are many documents.

How do you check the result before you rely on it?

Open the original and the Markdown file side by side and look for the places conversions usually go wrong:

  • Search the .md file for <table, <img and <span to find HTML that Pandoc wrote.
  • Check that every heading you expect starts with #.
  • Open two or three image links to confirm the files exist at those paths.
  • Compare numbered lists, since a list that restarts in Word may continue in Markdown, or the reverse.
  • Look at the end of the file for footnotes.

Word documents in Noteline

Noteline, which we make, converts formatting when you copy from Word and paste into an empty note, so headings, lists, links and tables arrive as Markdown (pasting into a note that already has text, or with Cmd+Shift+V or Ctrl+Shift+V, gives plain text). Images are not rendered in the editor, only their alt text, so use Pandoc's --extract-media when you need the image files. To go back the other way, the desktop app exports a note to Word with Cmd+Option+E (Ctrl+Alt+E on Windows and Linux) using a copy of Pandoc built into the app; see Word and PDF export.

Your next document starts with a note.

Turn Markdown into Word and PDF on your desktop, even offline.

Try desktop free for 14 days ↓Free on iPhone, iPad and Android →

Desktop: 14-day trial, then $9.99 once. Mobile apps: free. No account.

Keep reading

  • The .md file
  • Markdown tables
  • How to keep AI meeting notes as Markdown files you own
  • AI memory files: what your assistant should remember, kept in Markdown
  • An AI research workflow in Markdown: sources, summaries and claims

A Markdown note editor with everything you need

We’re listening

Tell us what you need or what gets in your way. If something isn’t working, write to us any time.

contact@noteline.io→

Product

  • Download
  • Pricing
  • Features
  • Changelog

Learn

  • Markdown syntax
  • Use cases
  • Blog

Compare

  • vs Obsidian
  • vs Notion

Support

  • Help
  • Support
  • Privacy
  • Terms

© 2026 Notelinecontact@noteline.io