You need the words from a piece of HTML without the markup. Perhaps it is a newsletter template that needs a plain-text alternative, product descriptions exported from a CMS full of <p> and <strong> tags, a saved web page you want to quote, or HTML stored in a database field that has to go into a spreadsheet. Deleting tags by hand is slow, and naive tag stripping leaves you with one long unreadable paragraph and codes like & and scattered everywhere.
This guide explains what a good HTML-to-text conversion preserves, why a simple find-and-replace of tags fails, and how to get clean, readable plain text with a browser tool, from a web browser directly, or with command-line and code options.
What "plain text" should keep
HTML carries two things: content and presentation. Converting to plain text drops the presentation, but a good conversion keeps the structure that matters for reading:
- Paragraph breaks. Each
<p>, heading and block element should start on its own line, with a blank line between paragraphs. - Line breaks.
<br>becomes a single new line. - Lists.
<li>items should appear as bullets or numbers, with nested lists indented. - Links. The link text alone may lose information, so it is often useful to add the URL in brackets after it.
- Images. Alt text can stand in for an image when it carries meaning.
- Tables. Cells should be separated so columns remain distinguishable.
It should drop everything that is not content: scripts, styles, the document head, hidden templates, form dropdowns and embedded frames.
Entities
HTML represents some characters as entities: & for &, < for <, € for €, for a non-breaking space, and numeric forms like —. Plain text should contain the actual characters, so entities must be decoded. Our guide on when to use HTML entities explains why they exist in the first place.
Why regex tag stripping falls short
A common quick fix is a regular expression such as <[^>]+> replaced with nothing. It removes tags, but:
- Paragraphs, headings and list items run together, because the tags that separated them are gone and HTML source line breaks rarely match the visual layout.
- Content inside
<script>and<style>survives as visible text, so you get CSS rules and JavaScript in your output. - Entities remain encoded.
- Attributes containing
>characters, comments and unusual markup can break the pattern.
Parsing the HTML properly, the way a browser does, and then walking through the elements avoids all of these problems.
Convert HTML to text in your browser
Our HTML to Text Converter parses HTML with the browser's own parser into an inert document. Scripts never run, and images and stylesheets are never fetched, so it is safe to paste untrusted HTML.
- Open HTML to Text Converter and paste your markup into HTML source. The Sample is a small newsletter with a list, a table, entities, a link and a script that does not run.
- Choose the options:
- Show link URLs adds the address after the link text as "text (https://…)". Links whose text is already the URL are not repeated.
- Keep image alt text writes image descriptions as [alt text].
- Bullets for lists prefixes items with • or 1. 2. 3. for ordered lists, indenting nested lists.
- UPPERCASE headings makes H1 to H3 headings stand out in plain text.
- Read the result in Plain text. The summary compares the character count of the HTML and the text.
- Click Copy or Download.
Scripts, styles, the head section, SVG graphics, iframes and select menus are skipped automatically. Content inside <pre> keeps its original spacing.
Other ways to get plain text
Copy from the browser
The simplest method is often to open the HTML in a browser, select the content and copy it. Pasting into a plain-text editor, or using Paste as plain text (Ctrl+Shift+V in many apps), gives readable text with sensible line breaks. This works well for a single visible page, but not for HTML stored in a file or database field, and link URLs are lost. To view a raw HTML snippet safely first, the HTML Viewer renders it for you.
Convert to Markdown instead
If you want to keep headings, bold text, links and lists in a lightweight format that is still readable as text, HTML to Markdown is often a better target than pure plain text. Markdown is also easy to convert back to HTML later.
Command line
Text-mode browsers such as lynx -dump page.html or w3m -dump page.html render HTML to formatted text, including numbered link references. Tools like pandoc -t plain also convert HTML to plain text. These are ideal for batches of files.
In code
Most languages have a proper HTML parser. In Python, BeautifulSoup(html, "html.parser").get_text("\n") extracts text with line separators, and libraries such as html2text produce Markdown-like output. In JavaScript running in a browser, DOMParser gives you a parsed document to walk. Avoid regex-only solutions for anything beyond trivially simple HTML.
Tips and troubleshooting
Plain-text email alternatives
Many email platforms send a plain-text part alongside HTML for clients that prefer it. Converting the HTML with link URLs shown gives recipients working addresses. Review the result: tracking links can be long, and layout tables in email templates sometimes produce stray tab characters.
Too many blank lines
Complex layouts with nested divs can create extra spacing. The converter collapses runs of blank lines to one, but you can tidy further with Remove Extra Spaces.
Table data
Cells are separated by tabs, which paste neatly into spreadsheet columns. For large tables that need to stay tabular, extracting them as CSV or viewing them in a spreadsheet is more reliable.
Only need the links?
If what you really want from the HTML is the list of URLs, use the URL Extractor on the source instead.
Tidy the HTML first
Minified HTML on one line converts fine, since structure comes from the tags. But if you want to inspect the source before converting, run it through the HTML Formatter to make it readable.
Frequently asked questions
How do I remove HTML tags but keep line breaks?
Use a converter that treats block elements and <br> tags as line breaks, rather than deleting tags with a regex. Our tool keeps paragraphs, headings, list items and line breaks.
Is it safe to paste HTML that contains scripts?
Yes, with our converter. It parses HTML into an inert document, so scripts are skipped and never executed, and external images and styles are not loaded.
How do I keep links when converting HTML to text?
Turn on Show link URLs. Each link appears as its text followed by the URL in brackets.
Does the converter decode entities like & and ?
Yes. Entities are decoded into real characters, and non-breaking spaces are converted to ordinary spaces.
What is the difference between HTML to text and HTML to Markdown?
Plain text keeps only the words and basic structure. Markdown also keeps formatting such as headings, bold, links and lists in a readable syntax that can be turned back into HTML.