HTML Cleaner
Remove inline styles, Word junk, and empty tags from HTML.
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, andborder. - Word and Office markup – namespaced tags like
o:pare unwrapped and namespaced attributes are dropped. - Script and style blocks, plus inline event handlers such as
onclickandonload. - Comments, including Office conditional comments.
- data-* attributes left behind by editors and frameworks.
- Bare
spanandfonttags that no longer have any attributes are unwrapped, keeping their text. - Empty elements like
<p> </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
- Paste the messy HTML (or click Sample to load a Word-style example).
- Choose which kinds of cruft to remove with the switches.
- 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.
Related tools
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
Does it work with HTML pasted from Microsoft Word?
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.
Will it change my text?
No. Only markup is changed. Non-breaking spaces are turned into normal spaces so text wraps naturally; all words stay as they are.
Which elements are never removed as empty?
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.
Is the output formatted?
The cleaner keeps the original line structure. Run the result through the HTML Beautifier if you want consistent indentation.