HTML Cleaner: Clean HTML Code and Keep the Structure

Paste HTML code, or copy straight from a web page or ChatGPT, and get clean HTML back. Inline styles, classes, comments and empty tags go; headings, lists, links and tables stay. Below the result you see exactly what was removed.

Remove attributes
Remove tags

Frequently asked questions

What is the difference between this and Strip HTML?

Strip HTML takes every tag away and leaves plain text. The HTML Cleaner keeps the HTML and takes away the clutter around it: styles, classes, comments, empty tags. Use Strip HTML when you want words, and this page when you want markup you can paste into a CMS, a template or a code editor.

How do I remove inline styles from HTML?

Paste the HTML and leave Inline styles and old formatting ticked. Every style attribute goes, and so do the attributes that did the same job before CSS: align, bgcolor, border, cellpadding and width on tables. Bold and italic that only existed as a style are turned into real <strong> and <em> tags first, so they are not lost with the styles.

Can I clean HTML I copied from ChatGPT?

Yes. Copy the answer, paste it here, and the page takes the HTML behind it rather than the plain words. ChatGPT puts data-start and data-end on every tag and writes bold as a styled span around a <strong>; the data attributes go, and the doubled bold becomes one <strong>.

What about WordPress block comments?

They are comments, so they go when Comments is ticked: <!-- wp:paragraph --> and the rest. The wp-block classes go with the classes, and the wrapper divs that are left with nothing on them are removed, while the headings, paragraphs and images inside them stay.

Why did a &lt;tbody&gt; appear in my table?

Because the HTML is read by your browser's own parser, and a browser always puts the rows of a table inside a <tbody>, whether or not it was written. The result shows the table the way browsers actually build it. It changes nothing about how the table looks.

Will it fix broken HTML?

Mostly, as a side effect. Tags that were never closed are closed, and tags in the wrong order are put right, the way a browser would read them. It is not a validator, though: it does not list errors, it just hands back the HTML as a browser understands it.

Is my HTML uploaded?

No. The cleaning happens in your browser, and nothing is sent to this server or anywhere else. The before and after view is drawn in a sandboxed frame that is not allowed to run scripts or load images, so even the original HTML cannot call home while you look at it.