Text · 52 tools · nothing uploads

Strip HTML tags

Strip HTML tags. Runs entirely on your device, nothing is uploaded.

Input

Options

live

Strip HTML tags removes every tag from a pasted HTML document, plus comments and contents of script and style elements, leaving the visible text. Entities like & decode back by default, which can be turned off, and runs of more than two blank lines collapse to one. It does not build a document tree, so malformed HTML can strip unevenly.

Questions

What happens to the content of a script or style tag?

The whole element, opening tag, contents and closing tag, is removed together, since that content is not visible page text; only the surrounding markup is stripped from ordinary elements, leaving their inner text behind.

Are HTML comments removed too?

Yes, always, before anything else runs; comment removal is not controlled by an option.

What does decodeEntities change?

With it on, the default, named entities like & and <, plus numeric entities like © or –, are converted to their real characters. Turn it off and entities are left as literal text in the output.

How complete is the entity table?

It covers about two dozen common named entities such as amp, nbsp, copy, mdash and euro, plus any numeric entity in decimal or hex form. A rarer named entity outside that list is left as written rather than guessed at.

Does it handle badly formed HTML correctly?

Not reliably. The tool matches tags with a regular expression rather than parsing a real DOM tree, so deeply malformed or unbalanced HTML, such as a stray unclosed script tag, can strip more or less than intended.

Related Text tools