Skip to main content
ponderloop

HTML to Text Converter

Paste HTML and the plain text appears as you type: tags, comments, scripts and styles are dropped, entities such as &amp; and &mdash; are decoded, paragraphs and <br> keep their line breaks, lists get “- ” or “1. ” markers and tables come out tab-separated. The example page, with 49 tags removed, becomes 179 characters in 31 words on 13 lines, starting “Spring Sale”. Links can be written as “text (url)”. The HTML is read by a small parser built for this page, never loaded into the page, and it never leaves your browser.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Stays in your browser

Replace the example: paste a page, an email body or a fragment of markup. The text updates as you type.

Your HTML is read as plain text on this device: it is never loaded into the page, never uploaded and not saved. Reload and it is gone.

Options

Plain text

49 tags removed: 179 characters, 31 words, 13 lines of text.

Counts

Characters
179
Words
31
Lines
13
Tags removed
49

What each part of the HTML becomes

Each row is the real result of the converter with the default options. “↵” marks a line break and “→” a tab.
MarkupHTMLPlain textNote
Tags and attributes<p class="intro">Hello <b>there</b></p>Hello thereOnly the text between tags is kept.
Comments and doctype<!DOCTYPE html><!-- note -->VisibleVisibleDropped, like conditional comments.
Script and styleA<script>alert(1)</script><style>p{}</style>BABTheir content is code, not text, so it is removed. So are <title>, <noscript> and <head>.
Paragraphs and headings<h1>Title</h1><p>One</p><p>Two</p>Title↵↵One↵↵TwoA blank line between blocks (or a single line break with “Line breaks only”).
Line breakLine one<br>Line twoLine one↵Line two<br> is one newline.
Divs and sections<div>a</div><div>b</div>a↵bEach block starts a new line.
Bulleted list<ul><li>Tea</li><li>Coffee</li></ul>- Tea↵- CoffeeEach item gets “- ”.
Numbered list<ol start="3"><li>Mix</li><li>Bake</li></ol>3. Mix↵4. BakeNumbers follow the list’s start and each item’s value.
Nested list<ul><li>Fruit<ul><li>Pear</li></ul></li></ul>- Fruit↵ - PearTwo spaces of indent per level.
Table<table><tr><th>Item</th><th>Qty</th></tr><tr><td>Bolt</td><td>12</td></tr></table>Item→Qty↵Bolt→12Cells separated by a tab, rows by a line break: paste it into a spreadsheet.
EntitiesCaf&eacute; &amp; cr&#232;me &#x20AC;5Café & crème €5Named, decimal and hex references are decoded.
Escaped markup&lt;b&gt;not bold&lt;/b&gt;<b>not bold</b>Decoded to visible text and never treated as a tag.
Extra whitespace<p>one two three</p>one two threeRuns of spaces, tabs and newlines become one space, as in a browser.
Preformatted text<pre>a b</pre>a↵ bSpaces and line breaks inside <pre> are kept.

What each option changes

The same HTML with one option changed. “↵” marks a line break.
OptionHTMLPlain textEffect
DefaultRead the <a href="https://example.com/guide?a=1&amp;b=2">guide</a> or <a href="https://example.com">https://example.com</a>.Read the guide or https://example.com.Link text only.
Show link addressesRead the <a href="https://example.com/guide?a=1&amp;b=2">guide</a> or <a href="https://example.com">https://example.com</a>.Read the guide (https://example.com/guide?a=1&b=2) or https://example.com.Writes “text (url)”. A link whose text already is the address is not repeated.
List markers on<ul><li>a</li><li>b</li></ul>- a↵- bItems start with “- ” or “1. ”.
List markers off<ul><li>a</li><li>b</li></ul>a↵bEach item is a plain line.
Blank lines between blocks<h2>T</h2><p>a</p><p>b</p>T↵↵a↵↵bParagraphs, headings, lists, tables and quotes are set apart.
Line breaks only<h2>T</h2><p>a</p><p>b</p>T↵a↵bEvery block is a single line break; no blank lines.

How to convert HTML to plain text

  1. Paste your HTML. Replace the example with a page, an email body or any fragment of markup. A full document with <head> and <script> is fine.
  2. Choose how it is laid out. Keep or drop the list markers, write links as “text (url)”, and switch on “Line breaks only” if you do not want blank lines between paragraphs.
  3. Check the plain text. The result updates as you type. The counts show its characters, words and lines, and how many tags were removed.
  4. Copy or download it. Copy the text to the clipboard or download it as a .txt file. Tables paste into a spreadsheet one cell per column.

Frequently asked questions

How do I convert HTML to plain text?
Paste the HTML into the box above. The converter removes every tag, comment, script and style, decodes entities such as &amp; and &eacute;, and keeps the structure a reader sees: line breaks for <br> and block elements, markers for list items and tab-separated table cells. Then copy the text or download it as a .txt file.
Is it safe to paste untrusted HTML?
Yes. The HTML is handled as a string by a parser written for this tool. It is never given to the browser’s HTML parser or inserted into the page, so scripts, event handlers, images and iframes in it cannot run or load anything. The result goes into a text box, which shows it as plain text.
What happens to script and style content?
It is removed, together with the content of <title>, <noscript>, <iframe>, <template> and the <head>. That content is code or metadata, not text on the page. The text of an HTML comment, including conditional comments for old Internet Explorer, is dropped as well.
How are links, images and tables handled?
A link keeps its text; turn on “Show link addresses” to get “text (url)”. Empty, #fragment and javascript: addresses are skipped. Images contribute nothing, because their alt text is not page text. Table cells are separated by a tab and rows by a line break, so a table pastes into a spreadsheet; a nested table or a paragraph inside a cell is flattened onto the same row.
Why do my line breaks and spaces look different from the HTML source?
Browsers ignore the line breaks and indentation in the source: any run of spaces, tabs and newlines is one space, and lines break only at <br> and block elements. The converter does the same, so the text matches what the page shows. Inside <pre> and <textarea> the spaces and line breaks are kept as written.
Which entities are decoded?
All of them: named references such as &copy; and &mdash; (the full list of 2,231 names in the HTML standard, including legacy names without a semicolon such as &amp), and decimal and hex references such as &#8364; and &#x20AC;. Decoding is the same as in the HTML Entity Encoder & Decoder. Escaped markup like &lt;b&gt; becomes the visible text “<b>” and is not read as a tag. Non-breaking spaces turn into ordinary spaces. To escape text for HTML, or decode entities while keeping the tags, use the HTML entity encoder and decoder.
What does “Line breaks only” do?
It removes the blank lines the converter puts around paragraphs, headings, lists, tables and quotes, so every block is separated by a single line break. Lines you break with <br> and blank lines inside <pre> are kept.
How is this different from copying the text from a web page?
Copying works on what is rendered and needs the page open in a browser. This works on the markup itself, so you can convert HTML from an email source, a CMS export, a code editor or a saved file without displaying it, and you get one consistent layout with list markers and tabbed tables.
Is there a size limit, and is my HTML uploaded?
Input up to 1,000,000 characters is converted in your browser; longer input is refused so the page stays responsive. Nothing is uploaded, stored or logged, and the text is gone when you close or reload the page. The only thing the site records, if you allow analytics, is that a button was used, never any of the text.

How it works

The input is read once, left to right, by a tokenizer that follows the main rules of the HTML standard’s tokenization stage: start and end tags with quoted and unquoted attributes, comments (including “<!-->” and “<!--->”), doctypes, CDATA and processing instructions as bogus comments, raw-text elements (script, style, title, noscript, iframe, noembed, noframes, textarea) that end only at their own end tag, and a “<” that starts nothing, which stays text. Text between tags is decoded with the HTML character reference rules and then collapsed the way a browser lays out normal text: runs of space, tab, line feed, form feed and carriage return become one space, leading and trailing space on a line is dropped and a non-breaking space is not collapsed (it is written as a plain space at the end). Block elements (div, section, article, header, footer, form, details and the like) ask for a line break and paragraphs, headings, blockquote, pre, hr, figure, dl and table ask for a blank line; a break that is already there is not doubled, and a <br> at the end of a block adds nothing. List items add “- ” or “N. ” (counting from the list’s start and each item’s value, with two spaces of indent per nesting level up to eight). Cells of the outermost table are joined with a tab and its rows with line breaks. The characters, words and lines come from the same counter as the Word Counter: characters are user-perceived characters, words are space-separated tokens (with dictionary segmentation for scripts written without spaces), and lines are the lines of the result. It does not run scripts, apply CSS (so display:none, hidden elements and ::before text are not considered), fetch anything or repair a broken document beyond the rules above.

Sources

All text & filesAll toolsHome & DIY calculators