HTML Code Cleaner
Paste HTML copied from Word, Google Docs, an e-mail or a page builder. Pick what to strip — inline styles, classes, empty tags, comments, Office markup — and get clean, indented HTML with a preview of how it renders.
Runs entirely in your browser — nothing you enter here is sent to a server.
Why pasted HTML is so messy
Word processors and page builders describe formatting in the most literal way they can: every paragraph carries its font, size, margins and colour inline, Word adds its own mso- styles, o:p tags and conditional comments, and nested <span> tags pile up wherever the formatting changed. The result looks right in one place and wrong everywhere else — the inline styles override your site's stylesheet, and the markup is ten times larger than the content.
Inline styles
Remove them so the text takes the fonts and colours of the page it lands in. This is the single biggest cleanup for CMS content.
Office markup
MsoNormal classes, mso- properties, <o:p> tags, lang attributes and XML islands only matter to Word.
Spans and empty tags
Spans with nothing left on them are unwrapped, and paragraphs that held only a non-breaking space are dropped.
Scripts and handlers
<script>, onclick and javascript: links are removed — they have no place in pasted content.
What the cleaner keeps
Structure and meaning stay: headings, paragraphs, lists, tables, links, images, bold and italic. The HTML is parsed by the browser's own parser, cleaned as a document tree and written out again with consistent indentation — block elements on their own lines, inline elements kept inside them — so the output is valid HTML, not a regular-expression guess.
Cleaning is about tidiness, not security. If HTML comes from untrusted users and is shown to others, run it through a server-side sanitizer with an allow-list, such as DOMPurify or the HTML sanitizer of your framework, every time it is saved or displayed.
Frequently asked questions
How do I clean HTML copied from Word?
Paste it into the left box. With the default options, inline styles, Mso classes, mso- properties, o:p tags, conditional comments and empty paragraphs are removed, and the clean HTML appears on the right with a preview.
Will it remove my links and images?
No. Links keep their href and images their src and alt. Only javascript: links are dropped. Tick "Keep only href, src, alt, title" to strip every other attribute as well.
Is the preview safe for HTML with scripts?
Yes. The preview is a sandboxed frame in which scripts cannot run, and the HTML is parsed without executing anything.
Can I get plain text instead of HTML?
Tick "Plain text only". The text content is kept with its line breaks, and every tag is removed.