DOCX to HTML Semantic Parser

Word can export HTML on its own, and the result is notorious: thousands of lines of inline styles, conditional comments, and mso- prefixed attributes wrapped around a few paragraphs of text. This converter reads the document structure instead and emits semantic markup.

How to use it

  1. Drop in a .docx file. The older binary .doc format is not supported.
  2. Document styles are mapped to semantic HTML elements in the page.
  3. Download the HTML.

Structure comes from styles, not appearance

A DOCX file is a ZIP archive containing XML that describes the document in Office Open XML format. Crucially, it records which named style each paragraph uses, so a paragraph styled Heading 1 is identifiable as a heading regardless of what font size it happens to render at.

That is what makes semantic conversion possible. A paragraph styled Heading 1 becomes an h1 element, Heading 2 becomes h2, list paragraphs become genuine ul and ol structures with proper nesting, and bold or italic runs become strong and em rather than span elements carrying inline CSS.

The consequence is that documents written properly convert well, and documents where the author faked headings by manually enlarging and bolding text convert into undifferentiated paragraphs. The information simply is not in the file: visually it looks like a heading, structurally it is body text. There is no way to recover intent that was never recorded, and this is the same reason such documents are inaccessible to screen readers.

What does not carry over

A number of Word features are page-layout concepts with no meaning in a reflowable HTML document, and others are editorial metadata rather than content.

Expect to lose the following:

Tables and images

Tables convert to standard table markup with rows and cells intact. Merged cells are handled through colspan and rowspan. Complex nested tables used for layout rather than data will convert structurally but are worth rebuilding, since layout tables are a poor pattern in HTML.

Embedded images are extracted from the archive and inlined as Base64 data URLs, which keeps the output as a single self-contained file. For a document with many large photographs, that produces a sizeable HTML file, and separating the images out is worthwhile before publishing.

At a glance

Accepted input.docx
OutputSemantic HTML fragment
ImagesInlined as Base64 data URLs
Not supportedLegacy .doc binary format

Frequently asked questions

My headings came out as ordinary paragraphs. Why?

They were probably formatted by hand, with a larger bold font, rather than using the Heading styles. Word records the named style, and if none was applied the paragraph is body text as far as the file is concerned. Applying real heading styles in Word fixes it, and also makes the document accessible.

Can it convert old .doc files?

No. The legacy .doc format is a binary format unrelated to DOCX. Open it in Word or LibreOffice and save as .docx first.

Where did my fonts and colours go?

They are dropped deliberately. The output is semantic markup meant to be styled by your own CSS, which is what makes it useful for a website rather than a visual clone of a Word page.

Do tracked changes appear in the output?

No. You get the current text of the document. Accept or reject changes in Word before converting if the revision state matters.

Read more

Working with documents: PDF, DOCX, and spreadsheets — Document formats encode intent as much as content, and conversions between them succeed or fail on whether that intent was recorded.

Related tools