Filter HTML tags, script blocks or custom patterns

Tick the filters you need or write a pattern and its replacement, then press Quick Filter. The run happens in the page, the result is plain text, and the tool is a text clean-up — not an XSS sanitiser.

Runs locally in your browser

How to filter tags, script blocks and patterns out of text

Paste text, tick one or more filters and press Quick Filter: Filter JS removes <script> blocks, Filter CSS removes <style> blocks, Filter HTML strips comments, declarations, real tags and character references, and Custom Filter runs your own regular expression. Several filters can be combined in one pass.

Everything is plain text work in the page — the input is never uploaded and never executed, and the result pane is a draft of cleaned text, not a security check.

  1. Paste the text into the input field.
  2. Tick Filter HTML, Filter JS, Filter CSS or Custom Filter; several can be active at once, and Custom Filter reveals the pattern and replacement fields.
  3. Press Quick Filter. The JS, CSS and HTML filters run first, in that order, then the custom replacement.
  4. Press Copy to take the plain result text, or Clear to empty the input and the result.

How the four filters behave

One pass, four filters

Filter JS and Filter CSS delete whole <script> and <style> blocks including the tags, regardless of attributes, case or line breaks. Filter HTML then removes HTML comments, <!doctype>-style declarations, real tags (an opening bracket must be followed by a letter, so “1 < 2 > 0” survives) and character references — named like &nbsp;, decimal like &#39; or hexadecimal like &#x1F600;.

The filters ignore the text between the markup: only what matches is removed, nothing is rewritten or reordered. If no filter is ticked, Quick Filter returns the input unchanged, and when several boxes are ticked the run order is always JS, CSS, HTML, custom — the order you clicked them makes no difference.

The custom filter

Custom Filter applies a JavaScript regular expression globally: the pattern is not escaped and is not HTML-aware, so meta characters such as \d, [a-z] or . work as in JavaScript. The replacement text goes to the same replace() call, which means $& (the match) and $1-style group references are interpreted.

An invalid pattern such as [ is reported with a message and clears the result pane instead of leaving the previous run on screen; an empty pattern matches at every position, so every gap between characters can receive the replacement. Custom Filter and the three checkboxes are mutually exclusive: ticking one unticks the other.

What the result is and is not

The result is plain text. The colours in the pane are display-only highlighting; Copy puts the unformatted text on the clipboard, which is what you paste into an editor or a file.

Filtering strings out of a document does not make untrusted HTML safe — this is a text clean-up tool, not an XSS filter or a sanitiser, and it cannot understand scripts that build markup at run time. Keep the original text until you have checked the result.

Recent tools: