Free tool / no signup

HTML Cleaner

Strip invisible and deceptive characters out of HTML without touching the markup: the tags, attributes, scripts, styles and code blocks come back exactly as they went in.

Runs on your device — nothing is uploaded
When you need this

What people use it for.

Cleaning HTML pasted out of a CMS, an email template or an AI chat tool before it goes live
Removing zero-width and no-break characters that break search, anchors and string comparison on a page
Sanitising copy for a page without asking an editor to re-enter it by hand
Checking whether markup you have been sent carries hidden text between the tags
How it works

What happens to your text.

The HTML is parsed into a real document in your browser, then walked node by node. Only text nodes are touched, and only those outside script, style, pre, code and textarea - the five places where an invisible character may be deliberate and rewriting it would break something. Each remaining text node goes through the same cleaner the rest of the site uses in its safe mode, which removes zero-width characters, tag characters, direction controls and stray control codes, and turns unusual spaces into ordinary ones. The document is then serialised back out, so structure, attributes and entities are unchanged and the diff is confined to the words.

Where it stops: This cleans text, not markup. It does not sanitise HTML for security: it will not strip a script tag, an onclick attribute or a javascript: URL, and it is not a defence against cross-site scripting - use a real sanitiser on anything untrusted. Because the input is parsed as a document, a fragment comes back wrapped in html and body, and malformed markup is repaired the way a browser repairs it rather than preserved as typed.

Questions

Common questions.

Does this remove HTML tags?

No. It is the opposite of a tag stripper: the markup is preserved exactly and only the text between the tags is cleaned. If you want the tags gone and the words kept, use the HTML to Text converter.

Is this an XSS sanitiser?

No, and it should not be used as one. It does not remove scripts, event handlers or dangerous URLs. It removes invisible and deceptive characters from visible text. Untrusted HTML needs a purpose-built sanitiser.

Why are code blocks left alone?

Inside pre and code, whitespace is content. A no-break space in a code sample may be exactly what is being demonstrated, so changing it would break the example rather than fix it.

Will my formatting change?

The markup does not change. Unusual spaces inside text become ordinary spaces, which is a visible change by design - that is what makes the text searchable and comparable again.

Is the HTML uploaded anywhere?

No. It is parsed and cleaned by your own browser, and nothing is sent to a server.

Need the complete analysis?

The main WordMark sanitizer combines character forensics, statistical analysis, protected-data checks, alternatives, diffs and reports in one view.

Open full sanitizer
Related free tools

You might also need.