Convert HTML to plain text

What an HTML to text converter keeps and loses, including structure, links, entities and hidden content, and when plain text is the right output for your use.

An HTML-to-text converter takes marked-up content, such as a web page, an email template or a CMS export, and returns only the readable characters. The result is portable and easy to process. It is not the same document with the styling removed, though. Structure, links and anything that existed only in markup or CSS can disappear. This review explains what the conversion changes, where it holds up and where it doesn't.

Is plain text the right output for your use?

Converting HTML to plain text works well in two situations: the destination cannot render markup, or you need the words rather than the layout. Typical examples are plain-text email parts, SMS or push notifications, log entries, search indexes, data fields, word counts, diffs, and input for text-analysis or language-model pipelines. The main benefit is that the output works almost anywhere characters can be pasted or stored.

The decisive tradeoff is structure. Headings, lists, tables, emphasis and links carry meaning in HTML. A good converter approximates some of that with line breaks, bullet characters or appended link destinations. A poor one flattens everything into a single run of text. Some readers need to navigate the content, follow its links or compare rows in a table. For them, keep the HTML or a structured format such as Markdown, and offer plain text only as a fallback.

Plain text is also preferable when the HTML is untrusted and you only need its content. Stripping markup removes the elements that execute code or load resources, as long as the converter discards script and style content instead of leaving it behind as text. Removing tags is not the same as sanitizing for reuse, however. If the converted text is later placed back into a web page, it still needs to be escaped there.

What the conversion actually changes

Converting HTML to text changes the stored characters, not just their appearance. The tags are deleted, and so is everything that existed only in markup or stylesheets. Several distinct operations usually happen at once:

  • Tag removal: elements such as headings, paragraphs and spans are dropped, and only their text content remains.
  • Entity decoding: references like & and < become the characters & and <. A   becomes a no-break space (U+00A0). It looks like an ordinary space but may not match one in searches or comparisons.
  • Whitespace normalization: browsers collapse runs of spaces and line breaks when rendering HTML, so a converter has to decide where line breaks belong. Most add them after block elements such as paragraphs, headings and list items, and results differ between tools.
  • Removal of non-content elements: script and style elements should be discarded entirely. Naive tag-stripping removes only the tags and leaves their contents behind.
  • Loss of CSS presentation: bold, italics, colors, fonts and layout disappear. Text changed only by CSS reverts to its stored form unless the converter works from rendered text. For example, headings displayed in capitals through text-transform come back in their original case.

Terms such as "reverse," "mirror" or "font" often appear next to text tools, but none of them describes this conversion. HTML-to-text does not reorder characters or flip glyphs. It also does not turn bold styling into Unicode "bold" letters. That is a separate substitution technique, and it produces different characters that assistive technology handles poorly. A tool that promises styled output from HTML is doing something beyond plain-text conversion.

Source text versus rendered text

Converters start from one of two places, and the choice affects the output. A source-based converter parses the HTML and collects every text node. In browser terms, this resembles the DOM textContent property, which returns all text, including content hidden with CSS and the contents of script and style elements. A rendering-aware approach resembles innerText, which takes CSS into account. It skips elements hidden with display: none and reflects visual line breaks.

Neither approach is always correct. Source-based output can surface hidden text, such as collapsed menus, labels meant only for screen readers, or tracking snippets. Rendering-aware output matches what a sighted visitor saw but can drop text intended for assistive technology. Check which behavior a tool documents. If it doesn't say, test it with a page that contains hidden content.

An illustrative example

The snippet below is a constructed example, not a test of any particular tool. It shows how much the same input can vary depending on how it is converted.

<h2>Shipping &amp; returns</h2>
<p>Orders ship in <strong>two</strong> business days.</p>
<ul>
  <li>Free returns</li>
  <li>No restocking fee</li>
</ul>
<script>trackView();</script>

A careful converter decodes the entity, drops the script and adds breaks after block elements. One plausible result follows. Bullet characters and spacing vary by tool.

Shipping & returns

Orders ship in two business days.

- Free returns
- No restocking fee

Naive tag-stripping deletes only the angle-bracketed tags. The entity stays encoded, the source indentation survives, and the script's code is left in the text:

Shipping &amp; returns
Orders ship in two business days.

  Free returns
  No restocking fee

trackView();

The conversion does not reorder characters. Combining accents and multi-code-point emoji therefore pass through intact, provided the tool reads and writes the correct character encoding. If the encoding is mismatched, you will see garbled sequences where accents or emoji should be. Test with any non-ASCII content you depend on.

Will the result stay readable after copying or sharing?

Plain text copies cleanly in one respect: no hidden formatting travels with it, so what you paste is what you get. The limits show up elsewhere.

Reading order and structure

The output follows the order of the HTML source. Pages laid out with CSS grids, floats or positioning can show content in a different visual order, so sidebars, captions or footers may end up in the middle of the main text. Tables are the hardest case. Once flattened, cells read row by row with no column headers attached, and complex tables can become hard to interpret. If a table matters, check it by hand or keep it in a structured format.

Links and images

Link text survives, but the destination usually does not. Some converters keep it by appending it in brackets or as a footnote. Without the destination, phrases like "click here" become meaningless. Images disappear. Converters that output alt text keep the image's description, and those that don't leave gaps in the text. Decide which behavior you need before choosing a tool.

Accessibility

Screen readers rely on HTML semantics to announce structure and let users navigate. These include heading levels, list markup, table headers, and language and direction attributes. Plain text removes all of them, so assistive technology reads the result as one linear stream. That is acceptable for short content such as a notification or a one-paragraph message. Long documents become much harder to skim without headings. No specific screen reader was tested with converted output for this review. Treat this as a general consequence of losing markup, and test with the assistive technology your readers actually use.

Mixed-direction text

HTML can control right-to-left and left-to-right runs with the dir attribute and the bdi element. Both are markup, so conversion removes them. The Unicode bidirectional algorithm still applies to the raw characters, but text that relied on explicit isolation may display in a different order. A Hebrew or Arabic name next to numbers or punctuation is a common example. A converter could preserve the intent by inserting Unicode isolate characters. Check whether yours documents this, and verify mixed-script output in the place where it will be read.

Search and editing

Plain text is easy to index, search, diff and edit, which is a major reason to convert. Two things can get in the way. Leftover entities or no-break spaces can block matches that expect ordinary characters. Lost emphasis and heading cues also remove signals that something was important. If the output feeds a search index, confirm that entities are decoded and whitespace is normalized.

When you need a plain-text equivalent

Keep the HTML as the primary version when its structure helps readers. Add a plain-text version alongside it when some destinations can't use HTML. Common cases include:

  • Email: the MIME multipart/alternative format lets one message carry both an HTML part and a plain-text part, so clients and readers that prefer text get a readable version.
  • Notifications, SMS and chat previews that display only text.
  • Data exports, spreadsheets and form fields, where markup would appear as literal tags.
  • Logs, analytics and text-processing pipelines, where tags add noise.
  • Archiving or quoting, where the goal is a stable copy without formatting.

In each case, review the converted version as a document in its own right. Rewrite link phrasing that depends on clicking. Add back context that a heading or table used to provide. Make sure nothing hidden or scripted slipped through.

What to check before relying on a converter

  • Are script and style contents removed, not just their tags?
  • Are entities decoded, including no-break spaces?
  • Where are line breaks added, and can you still tell lists and headings apart?
  • Are links dropped, kept as text only, or kept with their destinations?
  • Is image alt text included?
  • Does the tool work from source or rendered text, and how does it handle hidden content?
  • Do accents, emoji and right-to-left scripts come through without garbling?
  • What happens to the content you submit? Look for a stated privacy or retention policy. A clean interface or the word "secure" says nothing about how data is handled. For sensitive material, a local library or offline tool avoids the question.

Limits of this review

No specific converters were tested for this article, and it reports no measurements, product features, prices or compatibility results. The behavior described reflects how HTML, CSS, Unicode text and DOM text properties work in general. Individual tools will differ. Confirm any claim about a particular tool or destination against its documentation or your own test on representative content.