DOCX to Markdown Converter (mammoth.js)
Migrating content from Word to a static-site generator, a wiki, or a docs platform is a recurring task and a chronically annoying one. Word's native XML format (the .docx zip with embedded XML parts) carries a lot of structure that Markdown does not need and a lot of styling that Markdown explicitly drops. The right conversion is structure-preserving and styling-shedding: keep the headings, lists, links, and tables; drop the font, color, and per-paragraph spacing overrides. mammoth.js is the well-tested library for exactly this transform, and this tool runs it in your browser so the document never leaves the tab.
What mammoth.js Preserves
Headings (Heading 1 through Heading 6 styles in Word map to # through ###### in Markdown), paragraphs, ordered and unordered lists (with nesting), hyperlinks, inline bold and italic, and the Word Quote and Intense Quote styles (as blockquotes). Monospaced or code-styled text is not detected automatically; map its style to code in the style-map box. Tables become GitHub-flavored Markdown tables, with the first row as the header. Images are embedded inline as data URIs, or left out with Skip images.
What mammoth.js Drops
Direct character formatting beyond bold/italic/code (font family, font size, color, highlight) — these have no Markdown equivalent and are intentionally dropped. Page-level constructs (headers, footers, page numbers, page breaks, multi-column layouts) — same reason. Tracked changes and comments — the rendered output is the accepted, comment-free version; the tracked-changes history is not part of the Markdown output. Equations made with the Word equation editor are not converted; for documents with serious mathematical content, a dedicated Word-to-LaTeX or Word-to-MathML tool is a better fit.
Why a Custom Style Map Is Sometimes Worth It
mammoth.js uses a style-map system that lets you specify how named Word styles convert to Markdown. The default map covers all the standard Heading and List styles. For documents that use custom styles (a corporate template often has a "Callout" style or a "Code Block" style that the default map doesn't recognize), you can provide a custom map at conversion time. Open Custom style map (advanced) and enter one rule per line in mammoth.js syntax, for example p[style-name='Callout'] => blockquote > p:fresh; your rules are added to the defaults. Most users never need this; for a one-off migration of a heavily-templated corpus it can be the difference between a clean output and one that needs hours of post-processing.
Browser-Only Conversion and the Privacy Posture
The whole conversion happens locally. mammoth.js is bundled into the page (about 493KB minified, loaded on demand the first time you convert a file). When you drop a .docx file in, it is read into a browser Blob via FileReader, parsed by mammoth.js as a zip archive, walked as XML, turned into HTML through the style map, and converted to Markdown by the same converter the HTML to Markdown tool uses (mammoth's own Markdown writer is deprecated and cannot write tables). Nothing crosses the network. This matters for any document that contains internal information — personnel records, legal drafts, financial reports — where uploading the file to a server-side converter would be a small but real disclosure risk. The Network tab in your browser confirms no upload occurs.
Pair this with the rest of the UDT document-conversion cluster: DOCX Metadata Inspector for examining author, dates, and document properties before or after conversion, PDF to DOCX for the upstream PDF case, Markdown Preview for previewing the converted output, and HTML to Markdown for the HTML-source case.
Related tools
- Before you convert, take a look at who authored the file and when — the DOCX Metadata Inspector reads the core, app, and custom properties from a .docx in your browser.
Frequently Asked Questions
Built by Derek Giordano · Part of Ultimate Design Tools