Strip HTML Tags – HTML to Plain Text

Convert HTML into readable plain text: tags removed, entities decoded, paragraphs and line breaks kept.

Loading tool…

About the Strip HTML Tags

A regular expression like /<[^>]*>/g fails on comments, > inside attributes and script contents. This tool uses the browser's HTML parser (DOMParser), the same one that renders web pages, and then walks the resulting tree. The parsed document is inert and never inserted into this page, so scripts do not run and images do not load.

Block elements such as <p>, headings, list items, table rows and <div> end a line, paragraphs and headings are separated by a blank line, and <br> becomes a line break. Table cells are separated by tabs. Content of <script>, <style>, <head> and <template> is dropped. Entities are decoded, so &mdash; becomes — and &amp; becomes &.

Keep links appends the URL after the link text, e.g. search index (https://example.com/search), which is useful for plain-text emails. Collapse extra whitespace behaves like a browser: runs of spaces become one, except inside <pre>.

How to use it

  1. Paste HTML or open an .html file.
  2. Choose whether to keep line breaks and link URLs.
  3. Copy the plain text or download it.

Frequently asked questions

How do I strip HTML tags in JavaScript?
In a browser: new DOMParser().parseFromString(html, 'text/html').body.textContent. It decodes entities but loses line breaks; this tool also inserts breaks for block elements.
Is it safe to paste untrusted HTML?
Yes. The HTML is parsed into a detached document that is never rendered, so scripts and event handlers are not executed.
Why is my inline JavaScript missing from the output?
Script and style contents are not visible text, so they are removed on purpose.

Related tools