TTKTheTextKit

HTML Tag Remover

Paste HTML to strip the tags and get the text. In readable mode paragraphs and list items become lines, extra spaces are collapsed and table cells are separated by tabs, so the result looks like the page. In tags only mode just the tags go and everything between them stays as written. Entities such as & and © are decoded, the content of script and style elements can be dropped, and link addresses can be kept in brackets. Everything runs in your browser.

Output

Lines and paragraphs as they look on the page, with extra spaces collapsed.

16 tags removed, 284 characters in, 109 out

The markup is read the way a browser reads it, not with a pattern, so a > inside a quoted attribute, a comment, the doctype and the content of script and style elements are handled correctly. A < that does not start a tag, as in 1 < 2, stays as text. In readable mode the content of the head element is skipped, table cells are separated by tabs and non-breaking spaces become spaces. Entities are decoded when they end with a semicolon, using the common names and every number form. Nothing is sanitized: the result is plain text to read, not safe HTML to insert in a page. Everything runs in your browser and nothing you paste is uploaded.

Related Tools

[6 suggestions]

About the HTML Tag Remover

The tool reads HTML with a small tokenizer, the way a browser does, and not with a pattern that looks for angle brackets. That matters for markup such as <a title="a > b">, where a greater than sign sits inside a quoted attribute and a simple pattern would cut the tag short. Comments, the doctype and processing instructions disappear, a less than sign that does not start a tag, as in 1 < 2, stays as text, and the content of script and style elements, which is code and not text, can be removed along with its tags. In readable mode block elements such as p, div, li, headings and table rows end a line, paragraphs and headings leave a blank line, a br tag is a line break, whitespace inside a paragraph collapses to single spaces as it does on a page, the content of pre keeps its spaces and line breaks, table cells are separated by a tab so a table pastes into a spreadsheet, and the head of a page is skipped. In tags only mode nothing but the tags is removed. Entities are decoded when they end in a semicolon, using about 200 common names such as nbsp, amp, copy and euro and every number form, with the HTML rules for the Windows-1252 range and for invalid numbers. The result is text to read, not sanitized HTML: removing tags is not a way to make untrusted input safe to put on a page. Everything runs in your browser and your HTML is never uploaded.

How do I remove HTML tags from text?▾

Paste the HTML into the box and the text appears below without the tags. Choose readable text to keep paragraphs and lists as separate lines, or tags only to remove nothing but the tags. Copy the result with the button.

Why not remove tags with a regular expression?▾

Because HTML is not that simple. A greater than sign can sit inside a quoted attribute, comments can hold tags, and script content is not text. A pattern such as a less than sign, anything, a greater than sign cuts these wrongly. This tool reads the markup the way a browser does.

What happens to script and style content?▾

By default it is removed together with its tags, because the code is not part of the text a reader sees. Untick the option to keep it as text.

Are entities like &amp; and &nbsp; converted?▾

Yes, when the option is on. Named entities such as &amp;, &copy; and &nbsp; and number forms such as &#169; and &#x1F600; become the characters they stand for. A reference needs its semicolon, and a name the tool does not know is left as it is.

Does it keep links and line breaks?▾

Line breaks are kept in readable mode, where paragraphs, list items and br tags become lines. Turn on the link option to write each address in brackets after its link text.

Is it safe to paste the result into a web page?▾

No. Stripping tags gives plain text for reading, not sanitized HTML. Characters such as less than and ampersand may still appear in it, so escape the text before putting it in a page.