I built a Markdown to Word converter that never uploads your document
Most online file converters work the same way: you upload your document, a server converts it, you download the result. For a Markdown to Word converter that is a strange trade. The conversion is cheap, the document is o
Most online file converters work the same way: you upload your document, a server converts it, you download the result. For a Markdown to Word converter that is a strange trade. The conversion is cheap, the document is often the one thing the user does not want to hand to a stranger, and the server costs money forever.
I built md-to-word.com the other way round. Nothing is uploaded. The page is static HTML; the converter is a small React island; both conversion engines run in the visitor's browser. Here is how it fits together and what I learned.
Two engines, one honest about its limits
The default engine is small: markdown-it parses the Markdown and the docx library writes a real Office Open XML file, with Word heading styles, real tables (repeating header rows), nested lists and code blocks. It runs in a Web Worker, so the live preview re-converts on every pause in typing without touching the main thread. The whole thing is a few hundred kilobytes and loads only when the widget scrolls into view.
What it cannot do honestly, it says so. LaTeX math stays as text. Footnotes stay inline. Each of those produces a visible warning rather than a document that is quietly wrong. That rule, never drop anything silently, shaped everything else.
Pandoc, in the browser, on demand
The second engine is Pandoc itself, compiled to WebAssembly by the pandoc-wasm project. It turns $E = mc^2$ into an editable Word equation object and [^1] into a real footnote that renumbers itself. It is also 57 MB of wasm, about 15 MB compressed, so it is strictly opt-in: a checkbox labelled "Best quality" that says what it costs before you tick it.
The mechanics:
- The wasm is fetched from unpkg. Cloudflare Pages, which hosts the site for free, rejects any asset over 25 MiB, so the binary cannot live with the site. unpkg serves the exact published package, with CORS and a one-year cache header, and costs nothing.
- The fetch and the conversion happen in a dedicated Web Worker with progress messages, so a 15 MB download never freezes the page.
- The Cache API keeps the binary after the first download. Second visit, no wait.
- If the download fails, the fast engine converts instead and the user is told which engine ran.
Content Security Policy needed two things I had not guessed at first: 'wasm-unsafe-eval' in script-src for the worker to instantiate the module, and the unpkg origin in connect-src. I ran the policy in report-only mode against a real conversion before enforcing it.
What "no server" buys
- Privacy that is checkable rather than promised: open the Network tab, convert a document, watch nothing leave.
- Zero running cost. The site is static files on a free tier plus a public CDN for one optional binary.
- Speed. The default conversion takes well under a second because there is no round trip.
What it costs
- The reverse direction (Word to Markdown, via mammoth and turndown) also runs client-side, but images stay on the user's disk; a converter that never reads your filesystem cannot embed them for you. The site says so instead of pretending.
- Everything has to be small. The static HTML carries the content for search engines; JavaScript is limited to the widget.
Things I did not expect
Putting the site behind a Cloudflare zone, rather than the bare Pages URL, switched on two defaults that hurt: a JavaScript bot-detection probe injected into every page (Lighthouse dropped from 100 to 76 until it was disabled through the API, because a Free zone has no switch for it) and a managed robots.txt that quietly told every AI crawler to go away. Worth checking on any new zone.
The other surprise was who turned up. The most common document people convert is not a README. It is a ChatGPT or Claude answer, pasted into Word, that came out as a page of hashes and asterisks. That ended up with its own guide.
Pandoc is GPL and credited on the About page; the fast engine is built on permissively licensed libraries.
If you write in Markdown and someone insists on Word, give it a try: md-to-word.com. Feedback welcome, especially documents that convert wrong; those are the useful bug reports.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.