HTML Tag Stripper
Strip HTML tags, scripts and styles from a page or snippet and keep readable text. Decodes entities and keeps line breaks if you want.
Strip HTML tags, scripts and styles from a page or snippet and keep readable text. Decodes entities and keeps line breaks if you want.
Copying text from a web page often brings markup with it. This tool removes the HTML tags and leaves the text.
Script and style blocks and comments are removed completely, entities such as & are decoded, and paragraph and line break tags can be turned into new lines.
HTML is made of tags, attributes, text, comments and entities. Removing tags with a simple pattern that deletes anything between angle brackets works for tidy input but fails in several cases. Script and style elements contain code and styling rather than readable content, so their entire contents must be dropped, not just the tags. Comments can contain angle brackets. Attribute values may include a greater-than sign. Entities such as ampersand amp, less-than lt and the non-breaking space must be decoded afterwards or the text will show the raw codes. Block level tags like p, div and li represent visual breaks, so replacing them with newlines preserves structure.
Text extraction is not a security measure. Stripping tags from untrusted input does not make it safe to insert in a page, because decoded entities can reintroduce angle brackets, for example turning an encoded script tag back into real markup when it is later output as HTML. When displaying user content, escape it for the output context or use a maintained sanitiser. Also note that extracted text loses link addresses, image descriptions unless they were in visible text, and the table structure, so rows and columns collapse into a single flow of text.
No. It extracts text for reading. To sanitise HTML for display, use a dedicated sanitiser on your server.
The tags are removed. Their URLs are not kept.
Tick Keep line breaks so that p, br, div and li tags become new lines.
No. It is processed in your browser.
No. The contents of script and style elements are code and styling rather than readable text, so they are removed together with their tags, along with HTML comments.
Inline tags removed without a separator can join neighbouring text. Turn on keep line breaks so block elements produce new lines, and review inline cases where the source had no spaces.