Strip the tags from HTML and keep only the readable text
This HTML tag remover takes tags such as <p> and <span>, along with attributes, scripts and comments, and leaves just the text a person would read. It parses the source the way a browser does, so paragraphs and list items end up on their own lines and table cells are separated by tabs. Line breaks and indentation that only exist to keep the code tidy are collapsed into a single space, just as they are on screen.
In the source box, the text that survives stays in the normal dark text color while tags, attributes, comments and scripts get their own colors. The bar below shows how many bytes of the source are readable text and what the rest was. If you want HTML back instead of plain text, you can keep only chosen tags such as p and a, or remove only chosen tags such as span and font.
When you need to remove HTML tags
- Moving a newsletter into a document: marketing email HTML is full of layout tables, inline styles and hidden preheader text meant for the inbox list. Keep only the sentences a subscriber sees and the result drops straight into a report or a set of notes.
- Editing the copy in a product description: descriptions exported from a store admin or a marketplace often wrap every line in nested
fontandspantags. Pull out the text to proofread it, or do the opposite and strip onlyspanandfontto slim the HTML down. - Counting the words in a blog post: WordPress block editor code mixes in comments like
<!-- wp:paragraph -->, so counting the raw code overstates the length. The character count above the result shows totals with and without spaces. - Before pasting into an AI tool or a translator: tags and attributes use up input length too. Plain text fits more of the real content into the same limit, and nothing is left for the translator to break.
- Cleaning HTML stored in a spreadsheet cell: product exports from Shopify, WooCommerce or an ERP often put raw HTML in the description column. Text with no block tags keeps its original line breaks, and tables come out tab separated, ready to paste into a sheet.
How to use it
- Paste your code into the HTML source box. If you copy from a web page or an email and paste, the browser includes the page's HTML formatting; use “Paste as plain text” in the status line to undo that. Open .html, .xml or .svg files with “Open file” or by dropping them on the box.
- The cleaned text appears right away. There is no button to press.
- Choose the line layout (paragraphs, line by line or one line) and how to treat link addresses and images. For HTML with hidden text, such as a newsletter, check that “Drop hidden elements” is on.
- To keep some tags, pick “Keep chosen tags” or “Remove chosen tags” under What to keep, then click tags in the list for this document.
- Press “Copy”, or Ctrl+Enter (⌘+Enter) in the result box, to copy. “Save TXT” downloads a file (“Save HTML” when you are keeping tags).
Line breaks follow what you would see on screen
In HTML, tags decide where a line ends, not the line breaks in the source. This tool follows the browser's innerText rules: a blank line before and after p, a line break between blocks such as div, at each br and between table rows, and a tab between table cells. Headings, lists and tables also get blank lines around them so the result is easier to read. The results below are real output from this tool (⇥ marks a tab).
| Source | HTML | Result |
|---|---|---|
p paragraphs | <p>First paragraph</p><p>Second paragraph</p> | First paragraph |
Blocks such as div | <div>First line</div><div>Second line</div> | First line |
br line break | <p>First line<br>Second line</p> | First line |
ul list | <ul><li>Apples</li><li>Pears</li></ul> | • Apples |
ol numbered list (honors start) | <ol start="3"><li>Three</li><li>Four</li></ol> | 3. Three |
table | <table><tr><th>Item</th><th>Qty</th></tr><tr><td>Earbuds</td><td>1 pair</td></tr></table> | Item ⇥ Qty |
| Line breaks and indents inside the code | <p>Line breaks | Line breaks inside code and extra spaces |
pre preformatted text | <pre> Indented | Indented |
| Text with no block tags | Name: <b>Jane Doe</b> | Name: Jane Doe |
You can pick one of three line layouts. Paragraphs, shown in the table, puts a blank line between paragraphs and reads best as prose. Line by line breaks after each block with no blank lines, which suits lists and pasting into a spreadsheet. One line turns every line break and tab into a space, handy for a meta description or a single cell.
What goes wrong when a regex removes the tags
The most common shortcut is the regular expression <[^>]+>, which deletes everything from a < to the next >. It works on short snippets, but it cuts HTML differently from the way HTML is defined, so text disappears or junk is left behind, as below. A browser treats a < as plain text unless a letter, !, / or ? follows it, reads a > inside quotes as part of an attribute value, and takes everything inside script and style as raw text until the closing tag. This tool reads the source with the same rules.
| Source | Regex result | This tool |
|---|---|---|
<p>Alert me when stock is below 3 (a < b)</p> | Alert me when stock is below 3 (a everything after the < in the sentence is deleted | Alert me when stock is below 3 (a < b) |
<div data-note="a>b">Body text</div> | b">Body textthe > inside the attribute value ends the tag early | Body text |
<!--[if mso]><p>Outlook only</p><![endif]-->Visible text | Outlook onlyVisible texttext inside the comment survives | Visible text |
<script>if (n < 3) alert(n)</script>Body text | if (n Body textscript code leaks into the output | Body text |
<p>Price & shipping</p> | Price & shippingcharacter references stay as typed | Price & shipping |
<p>First paragraph</p><p>Second paragraph</p> | First paragraphSecond paragraphthe paragraphs run together | First paragraph |
How links, images and hidden text are handled
By default only text you can see on screen is kept. Links keep their text but lose the address, images are dropped, and elements hidden with the hidden attribute, display:none or visibility:hidden are dropped too. You can change that as shown below. If the link text is the same as the address, the address is not written twice, and in-page links starting with # and javascript: links get no address.
| Setting | HTML | Result |
|---|---|---|
| Link addresses ▸ After text | <p><a href="https://example.com/sale">See the sale</a></p> | See the sale (https://example.com/sale) |
| Link addresses ▸ List at end | <p><a href="https://example.com/sale">See the sale</a> or the <a href="https://example.com/faq">FAQ</a></p> | See the sale[1] or the FAQ[2] |
| Images ▸ Alt text | <p><img src="logo.png" alt="Logo"> Roberin</p> | [Image: Logo] Roberin |
| Drop hidden elements (default) | <div style="display:none">Preview text</div><p>Body text</p> | Body text |
Newsletters often hide a line of preview text at the very top of the body, then pad it with dozens of ‌ pairs so the inbox does not pull in more text. Turning on “Drop hidden elements” removes that line and the padding together, and the number of hidden elements removed is shown next to the switch.
Keeping or removing only chosen tags
These two modes return HTML instead of plain text. Keep chosen tags leaves the tags you clicked in the list for this document and strips every other tag. It starts with common text formatting tags selected: paragraphs, headings, lists, tables, links and bold. Remove chosen tags works the other way round: it strips only the tags you clicked and leaves the rest, starting with span and font. Both modes remove just the tags and keep the text inside. A line that held nothing but a removed tag is dropped, and where removing a block tag would run two pieces of text together, a line break goes in its place. All other line breaks, indentation and character references such as & in the source are left alone. When a tag is stripped, title and textarea take their contents with them.
- Attributes on kept tags: “Keep all” leaves the source attributes as they are, “Essential only” keeps just
href,src,alt,colspanandrowspan, and “Remove all” strips every attribute. “Keep chosen tags” starts on “Essential only”. - HTML copied from Google Docs: the whole content is wrapped in
<b style="font-weight:normal" id="docs-internal-guid-…">. This wrapper is not actually bold, so it is stripped even if you choose to keepb, and the entire result does not turn bold. Google Docs does store real bold as a style on aspan, though, so removingspanalso removes the bold. To carry formatting over, an HTML to Markdown converter is the better fit. - This is not a security sanitizer: do not put HTML produced here onto a website if someone else wrote it. With attributes left alone, things like
onclickstay, and even “Essential only” does not filter ajavascript:address inhref. Removing tags can also join split-up text into a brand-new tag (<<b>script>becomes<script>), so even “Remove all” attributes is not safe. For HTML that goes on a site, use a well-tested sanitizing library such as DOMPurify.
and invisible characters
An HTML becomes a non-breaking space (U+00A0) and stays in the result. It looks like an ordinary space, but find and replace in a word processor or a spreadsheet formula often treats it differently, which causes odd bugs. With “Clean and invisible characters” on, non-breaking spaces (U+00A0, U+2007, U+202F) become normal spaces, while the zero-width space (U+200B), word joiner (U+2060), BOM (U+FEFF), soft hyphen (U+00AD) and combining grapheme joiner (U+034F) are removed. A zero-width non-joiner (U+200C) next to a space is treated as email padding and removed as well. A zero-width joiner (U+200D) that links emoji, and a non-joiner between letters, are left alone.
Common surprises
- Text you saw on the page is missing: text that JavaScript adds later is not in the HTML you get from “View page source”. Copy the visible area and paste it, or copy the element from your browser's developer tools.
- A table comes out one cell per line: tables used for layout, as in email (
role="presentation", tables inside tables, one-column tables), do not join cells with tabs; each cell gets its own line. Line breaks inside the cells of a data table become spaces so rows do not shift when you paste into a spreadsheet. - Text hidden by a CSS class is still there: this tool does not compute stylesheets. It only looks at the
hiddenattribute and astylevalue written directly on the element. - The count differs from the code: line breaks and indents in the source collapse to one space, and
&becomes a single&. The character count above the result is closer to the length of the text you see on screen. - The page title is missing: the
<title>inside<head>is the name on the browser tab, not body text, so it is not counted. It appears in gray in the source box. - Pasted text lost its formatting: once only the text is extracted, bold, links and similar formatting are gone. To keep structure, use Keep chosen tags or convert to Markdown.
Limits: what this tool cannot know
- CSS
displayandwhite-spacevalues, and text added with::before, are not computed. Line breaks depend on the tag type, so a page laid out with CSS can look different from the result. - Relative addresses such as
/saleare added as written. They are not expanded into full URLs with the original site's domain. - Sources up to 2 MB are handled. Above 200,000 characters the color key is turned off and only the cleaning runs.
- Keeping or removing chosen tags looks at tag names only. It does not repair HTML whose opening and closing tags do not match, and it is not a security sanitizer.
- Only text files (.html, .htm, .xhtml, .xml, .svg and .txt) can be opened. Text inside Word or PDF documents cannot be read.
Sources
As of: the HTML parsing rules were checked against the WHATWG HTML Living Standard and MDN on October 22, 2026. Results in the tables are the output of this tool; the regex results are the same source with <[^>]+> replaced by nothing.
- 01WHATWG HTML: innerText and outerTextrendered text collection steps: two line breaks for p, one for blocks, a line break for br, tabs between table cells and line breaks between rows
- 02WHATWG HTML: 13.1.2 Elementsraw text elements (script, style) and escapable raw text elements (textarea, title)
- 03WHATWG HTML: 13.2.5.6 Tag open statea < not followed by a letter, !, / or ? is emitted as text
- 04MDN: DOMParser.parseFromString()scripts in a document parsed as text/html are not executed
- 05DOMPurify (cure53)a DOM-based XSS sanitizer for HTML, SVG and MathML
Frequently asked questions
How do I use the HTML tag remover?
Paste code into the HTML source box, or paste content copied from a web page, and the cleaned text appears at once. There is no button to press: check the result, then copy it or save it as a TXT file.
How is this different from removing tags with the regex <[^>]+>?
A regex treats everything from a '<' to the next '>' as a tag. That deletes text after a 'a < b' in your copy, leaves text after a '>' inside an attribute value, and keeps text inside Outlook conditional comments. This tool reads HTML with the same rules a browser uses, so it tells these cases apart.
How are line breaks decided?
They follow what you would see on screen. Paragraphs, headings, lists and tables get a blank line between them, while div blocks, list items, table rows and br tags get a line break, and line breaks and indents in the source code collapse into one space. Text with no block tags at all keeps its original line breaks.
Can I keep the link addresses?
Yes. Choose 'After text' under link addresses to get 'Shop the sale (https://…)' right after the link text, or 'List at end' to number the links like [1] and list the addresses at the bottom. If the link text is already the address, it is not written twice.
Why does text that was invisible in my email HTML disappear?
Newsletters often hide inbox preview text with styles like display:none. By default the tool drops hidden elements and keeps only text that is visible on screen. Turn off 'Drop hidden elements' if you want the hidden text too.
Can I keep or remove only certain tags?
Yes. Under What to keep, choose 'Keep chosen tags' or 'Remove chosen tags', then click tags in the list for the document. The result is HTML, and you can also strip attributes like class and style or keep only addresses and alt text.
Is HTML made with Keep chosen tags safe to put on a website?
Do not use it as a security sanitizer. If attributes are left alone, onclick and similar attributes stay, and even 'Essential only' does not filter a javascript: address in href. For HTML written by others, use a well-tested sanitizing library such as DOMPurify.
Is the HTML or file I paste sent to a server?
No. Pasted content and files are read only inside your browser, and nothing is stored in the address or in browser storage. Scripts in the source are not run, and image addresses are not loaded.