HTML Cleaner
runs in your browserno sign-upfree
Clean messy HTML from Word, Google Docs or web pages: remove inline styles, classes, spans, empty tags and comments, keeping headings, lists and links.
About this tool
HTML Cleaner turns messy HTML — pasted from Word, Google Docs, emails or old web pages — into simple, clean code. It keeps the structure (headings, paragraphs, lists, links, images and tables) and removes the clutter: inline styles, classes, spans and font tags, Word’s o:p and mso- markup, conditional comments, empty paragraphs and spaces. Every rule can be changed, so you decide exactly which tags and attributes stay.
How to use
- Paste the messy HTML (for Word, copy from the HTML view of your editor or save as a web page).
- The cleaned HTML appears at once with the recommended settings.
- Change which tags to keep, how attributes are handled, and the clean-up options if you need to.
- Copy the clean HTML or download it as a .html file.
FAQ
What does the cleaner remove by default?
Every tag that isn’t basic structure (spans, fonts, divs, Word’s o:p…), all attributes except href, src and alt, comments (including Word’s conditional comments), scripts and styles, empty tags, and spaces. Blank lines are tidied up.
Can I keep classes or more tags?
Yes. Set Attributes to "Keep all" to keep classes and styles, or add tag names to the list (for example div or span). The presets switch between common sets of tags.
What happens to attributes like style and class?
Choose under Attributes: keep them all, remove style, class, id, data-* and event handlers (onclick…), or keep only href, src and alt so links and images still work.
How do I make the cleaned HTML readable?
Copy it into the HTML Formatter to indent it neatly, or the Online HTML Editor to see it rendered.
Is my HTML uploaded or run?
No. Everything happens in your browser, and the HTML is only read as text — scripts never run and images are never loaded.