Polysh for agents is in early access. Your coding agent records the demo, and Polysh finishes it. Join the waitlist →

HTML Cleaner

Reduce pasted HTML to clean, safe markup with only content tags left.

Loading your browser tool…

What HTML Cleaner does

HTML copied out of Word, Google Docs, email templates or a site builder carries layers of spans, inline styles and generated class names. Pasted into a CMS or help-center editor, it fights your site's styles and bloats the page. The cleaner rebuilds the markup from the content up and keeps only the tags that describe structure.

The status line under the result counts what was taken out, such as 3 inline styles or 2 wrapper tags. Switch the result to Preview to check that the cleaned version still reads correctly, and use More options to keep any category you need.

Example

Input

<div class="post"><p style="color:red" onclick="go()">Read the <a href="javascript:alert(1)">guide</a> or <a href="/help/">help center</a>.</p><span></span><!-- note --></div>

Result

<p>Read the guide or <a href="/help/" rel="noopener noreferrer">help center</a>.</p>

Status: Removed 2 wrapper tags, 1 inline style, 1 event handler, 1 unsafe link, 1 comment. The javascript: link is unwrapped so only its text stays, and the safe link gets rel="noopener noreferrer".

How to use HTML Cleaner

  1. Paste HTML into the HTML box, or click Open file to load an .html file.
  2. Open More options to keep inline styles, classes and ids, comments or empty elements, or to drop images or tables.
  3. Click Copy, or Download .html.

Good to know

  • Only a fixed set of content tags survives. Elements such as <details>, <abbr> or custom components are unwrapped to their text, so check interactive content afterwards.
  • Turning off Keep tables doesn't delete the data: each row becomes a paragraph with its cells separated by |.
  • Images keep src, alt, title, width and height, but srcset and loading are removed, so responsive image sets fall back to a single file.

Questions about HTML Cleaner

How do I clean HTML copied from Word or Google Docs?

Paste the HTML source, not the visible text, into the box. Word and Docs wrap text in spans with inline styles and class names; the cleaner removes those and keeps headings, paragraphs, lists, links and tables. Paste the result into your editor's HTML view.

Why did a link turn into plain text?

Its href used a scheme the cleaner treats as unsafe, such as javascript: or data:. The cleaner removes the link but keeps its text so the sentence still reads. Add a real https:// or relative URL in your editor if the link should go somewhere.

Can I keep classes for my own CSS?

Yes. Turn off Remove classes and ids in More options. Inline styles have their own switch, Remove inline styles, so you can keep classes and still drop hard-coded colours and fonts.

How is this different from the HTML Formatter?

The cleaner changes the markup by removing tags and attributes, then indents the result two spaces. The HTML Formatter changes only whitespace and keeps every element and attribute you pasted.