HTML cleaner for Word, Google Docs and CMS code

Paste HTML from Word, Google Docs, an email or a CMS editor. You get tidy HTML with only the tags you need, plus a safe preview. Nothing is uploaded.

Free, no account needed. Updated .

Short answer

An HTML cleaner removes the markup that editors add for their own use: inline styles, Office tags such as <o:p>, class and id attributes, comments and empty tags. This one does it in your browser with the options you choose, then removes scripts and event handlers with DOMPurify, so the result is safe to preview and paste.

How to clean HTML

  1. Paste the HTML code. From the code view of your CMS, an email template, a saved Word page or the developer tools of your browser. Up to 5 MB.
  2. Choose what to remove. The defaults remove Word and Google Docs markup, inline styles, classes and ids, empty tags and plain spans. Select Remove all other attributes for the barest HTML.
  3. Select Clean HTML. You get the clean code, a list of what was removed and a preview. Change an option and the result updates. Copy the code or download it as a .html file.

Why pasted HTML is messy

Word processors and visual editors save the look of every word, not only its meaning. Word adds Office tags such as <o:p>, mso- styles and MsoNormal classes. Google Docs puts a style on every span and wraps the whole paste in a <b> tag that is not bold. Website editors leave class and style attributes from the theme they were made for.

That markup causes real problems when you paste it somewhere else:

  • Your site's fonts, sizes and colors are overridden by inline styles from another document.
  • Empty paragraphs add random gaps, and a help article looks different from the ones around it.
  • The page is several times larger than its text, which slows editing and wastes space in emails.
  • Crawlers, search engines and AI tools have more noise to skip before they reach the content.

Example: a paragraph from Word

Copied from Word, two short paragraphs look like this (shortened):

html
<p class=MsoNormal style="margin:0in;mso-line-height-rule:exactly"><b><span style="font-size:14.0pt;font-family:Calibri">Returns</span></b><o:p></o:p></p>
<p class=MsoNormal><span style="font-family:Calibri">You can return an item within <b>30 days</b>.</span><o:p>&nbsp;</o:p></p>
<p class=MsoNormal><o:p>&nbsp;</o:p></p>

With the default options, the cleaner returns:

html
<p><b>Returns</b></p>
<p>You can return an item within <b>30 days</b>.</p>

The Office tags, the styles, the classes and the empty last paragraph are gone. The bold text stays, because bold is content, not decoration.

What each option does

HTML cleaner options
OptionRemovesKeeps
Word and Google Docs markupTags such as <o:p> and <w:sdt>, mso- styles, Mso classes, <font>, <meta>, <style> and lang, dir, width and border attributes, bookmark anchors, the Google Docs <b> wrapperWidth and height on images
Inline stylesEvery style attribute and <style> blockBold, italic and strikethrough written as styles, which become <strong>, <em> and <s> first
Class and idAll class and id attributesEverything else
Empty tagsTags with no text inside, also ones with only &nbsp;Images, line breaks, rules and table cells, which are content when empty
Plain spans<span> tags with no attributes left, keeping their textSpans that still have an attribute
&nbsp;Non-breaking spaces, replaced by normal spacesText
All other attributesEvery attribute not in the keep list, such as target, data-* and aria-*href, src, alt, title, colspan, rowspan, scope and list numbering

Comments are always removed. They are invisible on the page, and in Word HTML they hold conditional code for old versions of Outlook and Internet Explorer.

Safe output and a safe preview

Pasted HTML can carry code that runs: a <script> tag, an event handler such as onclick or onerror, or a javascript: link. Whatever options you choose, every result goes through DOMPurify, a widely used HTML sanitizer, which removes them. Forms, buttons, inputs and frames are removed too. The summary tells you how many unsafe parts were removed.

The preview shows the cleaned HTML inside a sandboxed frame that cannot run scripts, so even the preview cannot change this page.

What the cleaner does not do

  • It does not fix broken structure by guessing. HTML is parsed the way a browser parses it, so a missing closing tag is closed where the browser closes it. Check headings and lists in the result.
  • It does not turn styled text into headings. A paragraph in large bold text stays a paragraph. Apply a heading style in the source document, or change the tag after cleaning.
  • It does not convert to Markdown. For that, use the HTML to Markdown converter, or paste straight from the document into Google Docs to Markdown.
  • It keeps only the body. For a whole page, the head (title, meta tags, styles) is left out, because the cleaner is for content you paste into another page.

Clean HTML for help content

Help articles live longer than the editor they were written in. Clean, plain HTML with real headings, lists and tables moves between CMSs without surprises, is easier to translate, and is what crawlers and AI assistants read most reliably. If you want to write in Markdown and publish HTML, the Markdown to HTML converter produces the same kind of clean code.

Once your help pages are clean, they are also a good source for a customer support chatbot. Paperlink AI imports the public pages of your help center and answers customers only from them, and says so when the pages do not hold the answer.

Frequently asked questions

What does an HTML cleaner remove from Word HTML?

Office tags such as <o:p> and <w:sdt>, mso- styles, MsoNormal classes, conditional comments, font tags and lang attributes. Bold, italic, links, lists, headings and tables stay.

Will cleaning HTML change how my page looks?

Yes, on purpose. Removing styles and classes takes away the fonts, colors and spacing set in the pasted code, so your page shows it with your own site styles. Clear Remove inline styles if you need to keep them.

Why do Google Docs pastes have a <b> tag around everything?

Google Docs wraps copied content in a <b> tag with font-weight:normal and an id that starts with docs-internal-guid. It is not bold text. The cleaner unwraps it, and turns real bold and italic, which Docs writes as span styles, into <strong> and <em>.

Is the cleaned HTML safe to paste into my CMS?

Scripts, event handlers such as onclick, javascript: links, forms and frames are always removed with DOMPurify. Your CMS can still have its own rules about which tags it accepts, so check the result there.

Can I keep classes but remove styles?

Yes. Each removal is a separate option. Clear Remove class and id attributes and keep Remove inline styles selected. The result updates when you change an option.

Does the HTML cleaner upload my code?

No. It runs in your browser. The HTML is not sent to our servers, and analytics record only that a clean ran.

Newsletter

Support notes, once a month.

One email with what we learn about help centers, honest AI answers and support teams. Unsubscribe at any time.

We use your email only for this newsletter. See the Privacy Policy.