Markdown to Word with template

Upload a .docx and your Markdown is written into that file's layout: its heading, body, quote, code and table styles, its paper size and margins, its headers and footers, its list numbering and its theme fonts. The template's own body text, cover page and embedded fonts are not carried over.

Pro · template upload

Project Charter

Purpose

This charter authorises the Atlas migration and names its sponsor.

Scope

  1. Move the billing service to the new region
  2. Retire the legacy queue
  3. Update the runbooks

Sign-off

RoleNameDate
SponsorJ. Okafor2026-09-12
LeadM. Reyes2026-09-12
Upload your department's .docx above and these headings take its styles.

This preview is HTML. It shows the structure the .docx will have, not your template's Word styling — a browser cannot render a Word style sheet. The styles appear when you open the downloaded file.

Converted in your browser. Your file never leaves your device.
1

Paste your Markdown

Headings, lists, tables and code as usual. The content does not need to know anything about the template.

2

Upload a .docx as the template

Any Word file works: a past report, a letterhead, a thesis template. Its styles, page setup, headers, footers, numbering and theme are read in your browser, and the file is never uploaded.

3

Download the styled document

Your text, their document. Headings, quotes, code and tables take the fonts and spacing your template defines, on its paper, inside its margins, headers and footers.

How a Word template is applied to Markdown

A .docx is a zip archive. Alongside the text in word/document.xml it carries word/styles.xml, which defines what Heading 1, Normal, Quote and every other named style look like; word/numbering.xml, which defines list bullets and numbering schemes; word/settings.xml; word/theme/theme1.xml, which is where fonts written as "+Headings" or "+Body" are actually resolved; the header and footer parts, with their own images and links; and, inside the document, a section-properties block that fixes paper size, orientation and margins.

MDtoDOCX reads those parts and merges them into the file it has just built. Your Markdown is written out first as paragraphs that reference styles by name — a # becomes a paragraph styled Heading 1, a fenced block becomes Source Code, a pipe table uses Table Grid, a blockquote uses Quote — and then the layout parts from your .docx are written over the packed archive. Because the paragraphs only reference styles, they inherit whatever your template says those styles should look like, and because the surrounding parts come from your file too, they land on your paper inside your headers. This is the mechanism behind Pandoc's --reference-doc flag, which is why a reference document prepared for Pandoc works here without changes.

What is taken from your template

Style definitions first: the paragraph styles Normal, Title, Subtitle, Heading 1 through Heading 6, Quote, List Paragraph, Caption and Source Code; character styles such as Hyperlink and Verbatim Char; and table styles, including Table Grid or a custom one your organisation uses. For each of those the font, size, weight, colour, alignment, indentation, line spacing, space before and after, borders and shading come from your file.

Then the parts around them. The document theme is copied whole, which is what makes a style recorded as "+Headings" or "Calibri Light (Headings)" resolve against your typefaces rather than ours. The body section properties are copied: paper size and orientation, all four margins together with the header, footer and gutter distances, page borders, page-number format, columns, vertical alignment, a distinct first page, text direction and the document grid. Every header and footer that section refers to — default, first-page, odd and even — is copied as its own part, and so is everything inside it, so a letterhead image and a page-number field arrive intact and any external link still points where it did. Finally numbering.xml is merged rather than replaced, with ids offset so your bullet and numbering schemes sit alongside ours, and a whitelist of settings.xml — hyphenation, default tab stop, mirrored margins, different odd and even headers, compatibility flags and the theme language — is layered on top.

What is not taken, and why it matters

Five things stay behind. The template's own body text and cover page are never copied: every paragraph in the output comes from your Markdown, there is no switch to keep the template's content, and Pandoc's --reference-doc makes the same choice. Fonts embedded in the file are not copied either, so a template that leans on a licensed typeface packed into the .docx will fall back to whatever the reader has installed — install the font or name one they already have. Document metadata in docProps, meaning company, category and any custom properties, stays ours rather than yours. Watermarks and background shapes live in the template's body, so they leave with it, and so do content controls and building blocks. Footnote and endnote separators, printer settings and the attached-template pointer are excluded deliberately, because they refer to parts and ids that belong to your package and not to the output.

How the converter's own options interact

They fill the gaps, and a precedence setting decides how large the gaps are. Both of its modes agree on the important half: anything your template genuinely defines wins — named styles, page setup, headers and footers, numbering, theme and the whitelisted settings. They differ only where the template says nothing. The default, fill-gaps, keeps our document defaults and our definitions for the styles a normal Word file never mentions, so Code, CodeLabel and Quote keep our font and size. Template-wins stands the converter's typography down entirely: your document defaults replace ours, and our remaining fallback styles stop pinning a font and size so they inherit your theme fonts instead. Paper size and margins are identical either way, because a reference document always carries section properties and those always win.

Why merging parts cannot hand you a broken file

Editing a .docx at the package level is the kind of thing that produces a "the file is corrupt" dialog, so the merge is checked before you get it. Content types and relationships are rebuilt on save instead of being patched, and no part enters the archive without a registered content type. The finished package is then validated: every part must have a content type, every internal relationship must point at a part that exists, relationship ids must be unique, and the XML must parse. If any of that fails, the conversion returns the unmerged document with a warning rather than a file Word would refuse to open.

Making a template that works well

Open Word, create a blank document, and change the built-in styles through the Styles pane rather than formatting text directly: right-click Heading 1, choose Modify, set the font by name, then the size, colour and spacing. Repeat for Normal, the other heading levels, Quote and your table style. Then set the page up as you want the finished document to look — paper, margins, and the header and footer with your logo and page numbers — because those now travel with the file. Save the empty document and upload that. Editing the style is the part that matters. Selecting a heading and pressing the bold button applies direct formatting, which lives on that one paragraph and travels nowhere; changing the style definition writes the intent into styles.xml, where every document that uses the style picks it up and where this converter can read it. It is also why a document formatted by hand makes a poor template even though it looks right on screen.

We do not offer a template gallery. Your organisation already has documents that look correct; reusing one is faster and more accurate than picking from a list of strangers' designs.

Availability, preview and the honest caveat

Uploading a template is a Pro feature, so the free converter cannot load one. The preview on this page is HTML, and a browser cannot render a Word style sheet, so it shows the structure your document will have rather than your template's typography; the styling becomes visible when you open the downloaded .docx. If you only need a consistent font rather than a full house style, the free converter's font and paper options may already be enough. Tables in your Markdown follow the template's table style and keep every property described on the tables page, and the same template applies to LaTeX equations and Mermaid diagrams in the same document. If you work from the command line, the Pandoc tutorial explains the reference-doc flag and how the same file behaves in both. Plans and the refund window are on the pricing page; if the output is not what this page describes, tell us at support.

Templates: MDtoDOCX vs Pandoc vs copy-paste into a styled document

Template behaviourMDtoDOCXPandoc --reference-docPaste into your template
Heading and body style definitionsFrom your .docxFrom your .docxOnly if you reapply each heading by hand
Table and code style definitionsFrom your .docxFrom your .docxPasted tables keep the formatting they came with
Page size, orientation, marginsFrom your .docx, in both precedence modesFrom your .docxFrom the document you paste into
Headers, footers, logosFrom your .docx, images and links includedFrom your .docxFrom the document you paste into
List numbering definitionsMerged in from your .docxFrom your .docxPasted lists override them
Theme fonts and coloursFrom your .docx, so "+Headings" resolvesFrom your .docxFrom the document you paste into
Template body text and cover pageNot carried — your Markdown is the whole bodyNot carriedKept, you type into the document
Preview before downloadHTML preview of structure, not Word stylingNon/a
Install requiredNonePandocNone
Template file leaves your machineNo, merged in your browserNoNo
Reuse a Pandoc reference docYes — styles and page setup both applyYesn/a

Frequently asked questions

Do you provide Word templates to choose from?
No. You upload your own .docx and its styles, page setup and headers are applied. Any existing document from your organisation works, so there is nothing to browse or configure.
Is my template uploaded to your server?
No. The .docx is unzipped in your browser, the parts we reuse — word/styles.xml, the theme, the section properties, the header and footer parts, numbering.xml and part of settings.xml — are merged into the output there, and the finished file is zipped up locally as well. Nothing about the template is transmitted.
Are page margins, headers and footers taken from my template?
Yes. The body section properties come across whole — paper size, orientation, all four margins with the header, footer and gutter distances, page borders, page-number format, columns, vertical alignment, a different first page and the document grid — and every header and footer that section refers to is copied with it, including the images and links inside them, so a letterhead logo and a page-number field arrive intact. What does not come across: the template's own body text and cover page, fonts embedded in the file, its document properties, watermarks and background shapes, content controls and building blocks, and footnote separators.
Which styles does the template need to define?
Ideally Normal, Heading 1 to 6, Quote, List Paragraph, Caption, Source Code and Table Grid. Missing styles fall back to sensible defaults, so an ordinary Word document with default names is enough.
Why is my heading in a different font from the one in the template?
The theme travels with the template now, so a style recorded as "+Headings" or "Calibri Light (Headings)" resolves against your theme rather than ours. The remaining cause is usually an embedded font. Word can pack a licensed typeface into the .docx as an odttf part, and those parts are not copied, so the style still names the font but a reader who does not have it installed sees a substitute. Install the font, or point the style at one your readers already have.
Can I use a Pandoc reference.docx?
Yes, and the two agree on more than typography now. Both read the same named styles, and MDtoDOCX also takes the page setup, the headers and footers, the numbering and the theme from that same file, so a reference document tuned for Pandoc produces the same geometry here. Neither tool copies the reference document's own body text.
What happens to the text already in my template?
Nothing of it is copied, by design — Pandoc's --reference-doc behaves the same way. Every paragraph in the output comes from your Markdown, so the template's cover page and its existing body do not appear, and there is no option to keep them or to append to them. Anything anchored in that body leaves with it, including watermarks, background shapes, content controls and building blocks. Headers and footers are the exception, because they are separate parts, and those are copied.
Does my template override the converter's own font and size?
Wherever it actually defines something, yes, and a precedence setting decides what happens everywhere else. The default, fill-gaps, keeps our document defaults and our definitions for styles a normal template never mentions — Code, CodeLabel, Quote — while the template wins for every style it does define. Template-wins steps our typography aside completely: the template's document defaults replace ours, and our fallback styles stop pinning a font and size so they inherit the template's theme fonts. Paper size and margins are the same in both modes, because a reference document always brings its own section properties.
Does it work with .dotx template files?
Yes. A .dotx has the same internal structure as a .docx. Both are accepted.
Can I see the template applied before I pay?
No, and we would rather say so. Uploading a template is a Pro feature, so the free converter cannot load one, and the preview on this page is HTML: a browser cannot render a Word style sheet, so it shows structure rather than your template's typography. The result is visible when you open the downloaded .docx. Pro starts at $4.9 for a 7-day pass, and the refund window is 7 days.