Strip HTML Tags (Extract Plain Text)
Paste HTML source and get back only the text: tags are removed, block tags and <br> become line breaks, and entities such as & are decoded. Four modes cover reading, keeping script text, keeping entities and preserving blank lines.
Stripping tags to leave only the text is routine when handling scrape results, content exported from an admin editor, or the source of an email. This tool removes the tags, decodes entities (& back to &, a numeric entity back to its character), and turns block-level and line-break tags into newlines so the paragraph structure of the original survives the trip.
Two expectations to set. Script and style are discarded along with their contents — they are not prose and would only become noise. And this is an extraction tool, not a sanitiser: what comes out is plain text, not renderable HTML, so it must not be used to guard against XSS; a proper allow-list sanitiser is the right tool for that.
Did this tool solve your problem?
Submitting sends the tool name, your input and the current result to the server. Please do not include ID numbers, phone numbers or other private data.
AI assistant It answers using your current input and result
Asking again sends your current input and result to the server once more. Please do not include private data.
How to use
- Paste the HTML source.
- Choose how to treat script and style text, entity text and blank lines.
- Read the extracted plain text.
- Check the paragraphs came through, and do not treat the output as safe HTML.
How it works
Basic usage
Paste HTML source into the box and the result area immediately shows plain text; the statistics below report how many tags were removed, entities decoded and script/style blocks dropped. The copy button yields directly usable text.
Choosing among the four modes
The default "standard" mode suits reading body text: scripts and styles are dropped with their content, block tags and <br> become newlines, entities decode to symbols, extra whitespace collapses. Choose "keep script and style text" to retain front-end snippets; "keep entities as-is" to inspect the original entity spelling (finding where hides); "don't collapse whitespace" when formatted HTML wraps every line in tags and you want the original blank-line rhythm.
It is not an XSS filter
Tags are stripped with regex — fast and effective on well-formed HTML, but there's no parsing and no safety judgment. Treat it as a "get the text" tool, never an anti-injection measure: user-submitted content must be escaped and whitelist-filtered server-side, not just angle-bracket-stripped on the front end.
Method: tags are removed with regular expressions (<!-- comments -->, <script> and <style> are removed together with their content by default). Block-level tags and <br> become newlines and other tags are deleted outright; with whitespace collapsing off, spaces and blank lines are preserved as-is. Entity decoding covers decimal and hexadecimal numeric entities plus common named entities, leaving unknown ones untouched. This is neither an HTML parser nor a security filter.
Code example
JavaScript Extracting plain text in the browser (more reliable)
// Let the browser parse it — far more reliable than a regex
// (a regex cannot handle nested tags or angle brackets inside attribute values)
const toText = (html) => {
const doc = new DOMParser().parseFromString(html, 'text/html');
doc.querySelectorAll('script, style').forEach((el) => el.remove());
return doc.body.innerText || doc.body.textContent || '';
};
// If you render the result back into a page, you still need allow-list sanitizing
// toText('<p>Body & symbols</p>') → 'Body & symbols'
Shell Extracting on the command line (drop script/style blocks first)
# Remove whole script/style blocks first, then strip tags (order matters)
sed -e '/<script/,/<\/script>/d' -e '/<style/,/<\/style>/d' page.html \
| sed -e 's/<[^>]*>//g' \
| grep -v '^[[:space:]]*$' > text.txt
# lynx / w3m are easier (they keep line breaks and list structure)
lynx -dump -nolist page.html > text.txt
FAQ
Why did the script and style contents disappear?
Default behavior, and the right choice for extracting body text: <script> holds JS code and <style> holds CSS rules — neither is human-readable prose, and mixing them in ruins the output. To analyze that code, switch to "keep script and style text"; the "dropped blocks" count then goes to zero.
Does it handle entities like &?
Yes, decoded by default: & → &, < → <, → non-breaking space, plus numeric references in decimal and hex (你 and 你), along with the common named entities. To keep the original spelling, switch to "keep entities as-is".
Can this tool prevent XSS attacks?
No — and don't use it that way. It merely deletes tags as strings; bypasses (malformed nesting, code hidden in attributes, encoding variants) are all out of scope. XSS defense must happen server-side with context-aware output escaping or a mature whitelist filter; treating front-end tag stripping as security is a classic mistake.
What happens to table content?
Cell text is concatenated in order; newlines near </tr> and </td> separate rows, but column alignment is lost — plain text has no table structure. If you still need the data, copy into a spreadsheet tool (or a CSV converter) rather than hoping to recover columns from text.
Why do stray angle brackets or half tags remain?
Because stripping is regex-based, malformed sources (unclosed tags, unescaped > inside attributes, mixed template syntax) can slip through. Also, body text that legitimately contains <div> decodes into the literal <div> — that's content, not a leftover tag; "keep entities as-is" distinguishes the two.
All the newlines vanished — how do I get them back?
Two cases: the source breaks lines with <div> while your chosen mode didn't convert them, or the result was pasted into a single-line input. The "standard" mode turns block tags and <br> into newlines; if the source itself has no newline semantics, no tool can restore what never existed — tidy it by hand.
Can the result be pasted straight into a web page or email?
Yes, but know that it's plain text: original bold, links and list structure are gone — pasting into a rich-text editor yields ordinary characters. To keep structure, skip this tool and use "paste as plain text" in the editor or a dedicated converter.
Will my HTML source be uploaded?
No. Processing happens in the browser; input never crosses a server and never enters localStorage — email source and admin-page snippets are safe to paste.