HTML to Text Converter
Paste HTML and the plain text appears as you type: tags, comments, scripts and styles are dropped, entities such as & and — 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
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.
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
| Markup | HTML | Plain text | Note |
|---|---|---|---|
| Tags and attributes | <p class="intro">Hello <b>there</b></p> | Hello there | Only the text between tags is kept. |
| Comments and doctype | <!DOCTYPE html><!-- note -->Visible | Visible | Dropped, like conditional comments. |
| Script and style | A<script>alert(1)</script><style>p{}</style>B | AB | Their 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↵↵Two | A blank line between blocks (or a single line break with “Line breaks only”). |
| Line break | Line one<br>Line two | Line one↵Line two | <br> is one newline. |
| Divs and sections | <div>a</div><div>b</div> | a↵b | Each block starts a new line. |
| Bulleted list | <ul><li>Tea</li><li>Coffee</li></ul> | - Tea↵- Coffee | Each item gets “- ”. |
| Numbered list | <ol start="3"><li>Mix</li><li>Bake</li></ol> | 3. Mix↵4. Bake | Numbers follow the list’s start and each item’s value. |
| Nested list | <ul><li>Fruit<ul><li>Pear</li></ul></li></ul> | - Fruit↵ - Pear | Two 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→12 | Cells separated by a tab, rows by a line break: paste it into a spreadsheet. |
| Entities | Café & crème €5 | Café & crème €5 | Named, decimal and hex references are decoded. |
| Escaped markup | <b>not bold</b> | <b>not bold</b> | Decoded to visible text and never treated as a tag. |
| Extra whitespace | <p>one two three</p> | one two three | Runs of spaces, tabs and newlines become one space, as in a browser. |
| Preformatted text | <pre>a b</pre> | a↵ b | Spaces and line breaks inside <pre> are kept. |
What each option changes
| Option | HTML | Plain text | Effect |
|---|---|---|---|
| Default | Read the <a href="https://example.com/guide?a=1&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 addresses | Read the <a href="https://example.com/guide?a=1&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↵- b | Items start with “- ” or “1. ”. |
| List markers off | <ul><li>a</li><li>b</li></ul> | a↵b | Each item is a plain line. |
| Blank lines between blocks | <h2>T</h2><p>a</p><p>b</p> | T↵↵a↵↵b | Paragraphs, headings, lists, tables and quotes are set apart. |
| Line breaks only | <h2>T</h2><p>a</p><p>b</p> | T↵a↵b | Every block is a single line break; no blank lines. |
How to convert HTML to plain text
- 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.
- 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.
- Check the plain text. The result updates as you type. The counts show its characters, words and lines, and how many tags were removed.
- 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 & and é, 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 © and — (the full list of 2,231 names in the HTML standard, including legacy names without a semicolon such as &), and decimal and hex references such as € and €. Decoding is the same as in the HTML Entity Encoder & Decoder. Escaped markup like <b> 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
More free tools
- Markdown to HTML ConverterConvert Markdown to HTML with a live, safe preview. CommonMark plus tables, strikethrough and task lists. Raw HTML is escaped. Runs in your browser.
- Remove Duplicate LinesRemove duplicate lines from a list, keep the first or last copy, and sort A to Z, naturally or at random. Works in any language and stays in your browser.
- Case ConverterConvert text to UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE. Stays in your browser.
- HTML Formatter & BeautifierBeautify messy HTML with 2 spaces, 4 spaces or tabs, or minify it. Script, style, pre and textarea content stays exactly as typed. Runs in your browser.
- Text CleanerClean pasted text: trim lines, collapse spaces, drop blank lines, join line breaks, straighten smart quotes, strip hidden characters and tags, with counts.
- Caesar Cipher and ROT13Encode and decode the Caesar cipher, ROT13, ROT47, Vigenère and Atbash, or test all 25 shifts and spot the most English-like. A puzzle toy, not encryption.