Overview
Convert a Word .docx document into clean HTML in your browser using Mammoth, then download it as HTML or as a PDF built with html2pdf. Mammoth reads the document's semantic structure - headings, lists, tables, images, links - and produces simple markup rather than trying to recreate Word's exact styling. Nothing is uploaded; conversion happens on your device.
How It Works
Select a .docx file (legacy .doc is not supported - save as .docx first). The converted HTML appears in a preview pane on a white surface, with the raw HTML source in a textarea below it for copying. Conversion notes from Mammoth - up to four warnings about anything it could not map - are listed so you know what changed. Download the .html file, copy the HTML to your clipboard, or press Download .pdf to render the same content into an A4 PDF. Re-selecting a file starts a fresh conversion.
Step-by-Step Usage Guide
- Select your .docx file.
- Review the preview and the conversion notes for dropped elements.
- Copy the HTML source or download the .html file.
- For PDF, press Download .pdf and check the result in a PDF reader.
Technical Specifications & Standards
Mammoth's philosophy is semantic HTML: paragraphs styled Heading 1 become h1 elements, bold becomes strong, italic becomes em, lists, tables, footnotes and links map to their HTML equivalents, and images are embedded inline as data URIs. What it deliberately drops is presentation: fonts, sizes, colours, columns, headers and footers, and most custom styling - the page tells you this before you upload. The tool adds a sanitisation pass over Mammoth's output (stripping script, iframe and similar elements, inline event handlers and javascript: URLs) as defence in depth, since Mammoth itself performs no sanitisation of source documents. Mammoth's warning messages are surfaced directly, which is how you learn that a text box or unsupported style was skipped. The PDF path renders the HTML through html2pdf (html2canvas rasterising at scale 2, A4 portrait, 10 mm margins, JPEG quality 0.98); a subtle layout bug that once produced blank PDFs was fixed by letting the content element flow at natural width inside an off-screen holder rather than pinning a fixed page width.
Targeted Use Cases
- Publishing a Word document as clean HTML on a website or CMS.
- Sharing a readable, lightweight version of a report with people without Word.
- Producing a PDF of a document for e-signing or archiving.
- Recovering the text and structure of a .docx for editing elsewhere.
Notes & Gotchas
- Use real Word styles (Heading 1, List Paragraph) in the source; Mammoth maps styles, not visual formatting.
- Read the conversion notes - they list what could not be converted rather than hiding it.
- For pixel-faithful documents, export PDF from Word itself; this path favours clean structure over fidelity.
- Remember .doc (1997 format) is not accepted; save as .docx first.
Frequently Asked Questions
What does the conversion preserve, and what is lost?
Preserved: headings, lists, tables, images, links, footnotes and bold/italic emphasis as semantic HTML. Lost: fonts, colours, columns, headers and footers, text boxes and other presentation styling - Mammoth maps meaning, not appearance.
Why is the HTML so plain compared to my document?
That is the design. Mammoth produces clean semantic markup by ignoring visual styling, which makes the output suitable for the web and easy to restyle with CSS.
Why did the PDF download come out blank in the past?
An earlier version pinned the content at a fixed page width off-screen, which the rasteriser captured as empty. The current build lets content flow at natural width in an off-screen holder, verified against byte-level output.
Is my document uploaded to a server?
No. The .docx is parsed in your browser by Mammoth, and both HTML and PDF are generated locally.