HTML Cleaner

Remove inline styles, Word junk, and empty tags from HTML.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

HTML Cleaner – Clean Up Messy HTML Code

The HTML cleaner turns cluttered markup into lean, semantic HTML. Text copied from Microsoft Word, Google Docs, page builders, or old CMS editors often carries dozens of inline styles, vendor tags, empty spans, and tracking attributes. This tool removes that noise while keeping your headings, paragraphs, links, lists, and tables intact.

What the cleaner removes

  • Inline styles and presentational attributes such as align, bgcolor, face, cellpadding, and border.
  • Word and Office markup – namespaced tags like o:p are unwrapped and namespaced attributes are dropped.
  • Script and style blocks, plus inline event handlers such as onclick and onload.
  • Comments, including Office conditional comments.
  • data-* attributes left behind by editors and frameworks.
  • Bare span and font tags that no longer have any attributes are unwrapped, keeping their text.
  • Empty elements like <p>&nbsp;</p> spacer paragraphs.

Optionally, you can also strip all class and id attributes when you want completely style-free markup that your own stylesheet will control.

Typical workflow

  1. Paste the messy HTML (or click Sample to load a Word-style example).
  2. Choose which kinds of cruft to remove with the switches.
  3. Copy the clean output or download it as clean.html.

Cleaning before publishing makes pages lighter, avoids conflicting inline styles that override your theme, and removes hidden tracking handlers you may not know were there. It also makes later edits far easier, because each paragraph is a simple p again instead of three nested spans.

Indent the result with the HTML Beautifier, shrink it for production with the HTML Minifier, or remove all tags with the HTML Stripper.

Frequently Asked Questions

Yes. Word-specific tags like o:p, mso styles, MsoNormal styling attributes, conditional comments, and empty spacer paragraphs are removed. Turn on "Remove classes" to drop the MsoNormal class names too.

No. Only markup is changed. Non-breaking spaces are turned into normal spaces so text wraps naturally; all words stay as they are.

Void elements like img, br, hr, and input, plus table cells, iframes, textareas, video, audio, and canvas are kept even when they have no text, because they are meaningful without content.

The cleaner keeps the original line structure. Run the result through the HTML Beautifier if you want consistent indentation.