Skip to content

How to Convert a Word Document to Clean HTML

By Durim Hoti · Last updated

Word saves documents with its own layout information: fonts, spacing, colors and page settings. A website already has its own styles, so for a web page you usually want only the structure of the document. That is what this kind of conversion produces.

Convert a Word document step by step

  1. Save the document as .docx if it is still an old .doc file.
  2. Open the Word to HTML converter and click Open .docx file, or paste the content into the paste area.
  3. Check the HTML on the right; switch to Preview to see it rendered.
  4. Tick Full HTML document if you need a standalone page instead of a fragment for a CMS.
  5. Click Copy HTML or Download HTML.

Example: meeting notes

A short Word document with a heading, a bold date, a bulleted list, a numbered list and a table gives this HTML (the table follows below it in the full output):

HTML output (start)
<h1>Team meeting notes</h1>
<p>Date: <strong>12 November</strong> – attendees: Sara, Tom and Lena.</p>
<h2>Decisions</h2>
<ul>
  <li>Launch the new pricing page on Monday.</li>
  <li>Keep the free plan, but <em>limit exports</em> to 10 per month.</li>
</ul>
<h2>Next steps</h2>
<ol>
  <li>Sara updates the copy.</li>
  <li>Tom checks the analytics.</li>
</ol>
The Word to HTML converter after opening meeting-notes.docx: the status says Converted meeting-notes.docx, and the HTML panel shows an h1 heading, a paragraph with strong text, a bulleted list, a numbered list and the start of a table.
meeting-notes.docx converted: Word's list and heading styles became real HTML elements.

Word's list styles became real <ul> and <ol> lists, and its heading styles became <h1> and <h2>. Table cells keep their paragraphs, so each cell contains a <p>.

What Word formatting survives

We made a second test file with formatting that often causes questions, and converted it:

In the Word fileIn the HTML
Heading 1 style<h1>
Bold text<strong>
Red, 18 pt, Comic Sans textPlain text: color, size and font dropped
Yellow highlightPlain text: highlight dropped
Comment on a sentenceNot included
FootnoteSuperscript link [1] and a numbered note at the end with a back link
Image with alt text<img> embedded as a data URL, alt text kept
Hyperlink<a href> to the same address
HTML output
<h1>Price list</h1>
<p>Red 18 pt Comic Sans text next to <strong>bold</strong> and highlighted words.</p>
<p>Basic plan: $5 per month<sup><a href="#footnote-1">[1]</a></sup></p>
<p>Logo: <img src="data:image/png;base64,iVBORw0…" alt="Company logo"></p>
<p>Details on <a href="https://example.com/pricing">our pricing page</a>.</p>
<ol>
  <li>
    <p>Prices exclude VAT. <a href="#footnote-ref-1">↑</a></p>
  </li>
</ol>

If a piece of text needs to stand out on the web page, give it meaning in Word: a heading style or bold. Those carry over; a color or font doesn't.

Common problems

The converter rejects the file

It is an old .doc file (Word 97–2003). Open it in Word, choose Save As and pick the .docx format.

The HTML is huge

Images are embedded as Base64 text, which is about a third larger than the image file. For a website, upload the images separately and replace the data: addresses with their URLs.

The text looks plain

That is intended: fonts, colors and sizes from Word aren't copied. Add classes or styles in your page, or use heading styles and bold in Word for structure.

Comments are missing

Word comments aren't part of the HTML. Resolve or copy them before converting if you need them.

What to do next

Tidy the indentation with the HTML formatter, or check the result in the HTML viewer. To turn the HTML into a PDF again, see how to convert HTML to PDF. Writing in Markdown instead of Word? See how to convert Markdown to HTML.

FAQ

Is my Word document uploaded?
No. The .docx file is read and converted in your browser; the document and the HTML stay on your device.
Can I convert an old .doc file?
No, only .docx. The converter tells you the file is an old .doc file. Open it in Word and save it as .docx first.
How large can the file be?
Up to 20 MB per .docx file.
Can I convert a Google Docs document?
Yes. Paste the content into the converter's paste area, or download the document from Google Docs as a .docx file and open that.
Do I get a complete HTML page or just the content?
By default you get the content as an HTML fragment to paste into a page or CMS. Tick Full HTML document to get a standalone page with <html>, <head> and <body>.

Try it and keep reading