OK
Removes inline styles
Inline styles
Deletes classes and IDs
Classes & IDs
Deletes empty HTML tags
Empty tags
remove tags with one space
Tags with 1 space
remove successive spaces
Successive spaces
delete comments
Comments
remove tag attributes
Tag attributes
html to plain text
To plain text
Smart non-breaking spaces
Smart  s
ai watermarks remove
AI Watermarks

html to plain textConvert HTML code to Plain Text

This tool removes HTML tags and returns the readable text content. Use it when you need a clean text version of HTML for emails, previews, logs, or text-only exports. For best results, consider tidying markup first. For example, remove HTML comments and strip unnecessary attributes - or normalize copied/AI text with Remove AI watermarks before converison ✎ᝰ.ᐟ⋆⑅˚₊

HTML Plain text Email-friendly SEO snippets

What this does 🛠️

  • Removes all HTML tags
  • Keeps the visible text content (human-readable output)
  • Ignores script and style content in typical browser parsing
  • Helps you create clean previews for newsletters, CMS fields, or search snippets

When to use it 🤔

  • Email drafts: convert rich HTML into a plain text alternative.
  • Meta descriptions: extract clean copy from a messy HTML fragment.
  • Product feeds: turn WYSIWYG descriptions into text-only exports.
  • Debugging: quickly see what text a page actually contains.
Tip: If your HTML comes from a copy-paste (Google Docs, Word, WYSIWYG editors), clean it first. Removing comments and attributes usually makes the final text cleaner and more consistent.

Example: Before and After

Before (HTML):

<h2 style="font-size:1.2em">Pretty HTML</h2>
<p>Formatter, Editor and <strong>Cleaner</strong>.</p>

After (plain text):

 Pretty HTML 
 Formatter, Editor and  Cleaner. 

How to use this page

  1. Paste or drop your HTML into the editor.
  2. Select To plain text.
  3. Click Pretty to strip tags.
  4. Copy or download the plain text result.

What "plain text" actually means

Plain text is just characters - no HTML tags, no styling, no layout. That also means some information may be lost during conversion: line breaks <br>, tables <table>, and visual emphasis (like <strong>) can't be represented the same way without formatting rules.

A good HTML to text converter focuses on the visible content and removes everything else. For many workflows (emails, previews, snippets, text-only exports), that's exactly what you want: short, readable text without markup noise.

Common pitfalls

  • Extra whitespace: multiple spaces and blank lines can appear after stripping tags.
  • Hidden text: content that was visually hidden might still be present in the HTML.
  • Links: removing tags also removes URLs unless you handle <a> tags specially.
  • Images: you may want to keep alt text if it's meaningful.

Best practices

  • Clean the source first (remove comments, strip attributes, normalize pasted text).
  • Decide whether you want to keep link URLs in parentheses.
  • Collapse repeated whitespace for a polished result.
  • Keep semantic text like headings and list items separated with newlines.

Quick comparison of approaches

There are multiple ways to convert HTML to plain text. If you're doing this in a browser, parsing into a document and reading textContent is usually the simplest and most reliable option.

Method Where it works Pros Cons
DOMParser + textContent Browsers Accurate parsing, handles malformed HTML well Doesn't preserve URLs or layout without extra logic
Regex stripping tags Anywhere Fast and simple for tiny snippets Breaks easily on real-world HTML. It can produce messy output
Server-side HTML parser Node/PHP/Python Great for automation and batch processing Requires dependencies and setup
PrettyHTML🎀 Any device Quick, consistent output, no code needed Less customizable than writing your own solution

Converting HTML to text with JavaScript

This function converts an HTML string into plain text by leveraging the browser’s DOM parser. It creates a temporary div element and assigns the HTML string to its innerHTML, which causes the browser to interpret the string as real HTML and build a DOM structure from it.
When the fuction then reads textContent (or innerText as a fallback), it extracts only the readable text from that structure, automatically ignoring and removing all HTML tags, attributes, and markup. The result is a clean plain-text version of the original HTML content.

function htmlToPlainText(html) {
  const div = document.createElement("div");
  div.innerHTML = html;
  return div.textContent || div.innerText || "";
}

Optional: keep links and collapse whitespace

For plain text emails and previews, it's often helpful to keep URLs (so the reader can still access them) and to collapse repeated whitespace. 

function htmlToPlainTextKeepLinks(html) {
  var doc = new DOMParser().parseFromString(html, 'text/html');
  Array.prototype.forEach.call(doc.querySelectorAll('a[href]'), function (a) {
    var text = (a.textContent || '').trim();
    var href = a.getAttribute('href');
    a.textContent = text ? (text + ' (' + href + ')') : href;
  });
  var out = (doc.body.textContent || '');
  out = out.replace(/\u00a0/g, ' ');
  out = out.replace(/[ \t]+\n/g, '\n');
  out = out.replace(/\n{3,}/g, '\n\n');
  out = out.replace(/[ \t]{2,}/g, ' ');
  return out.trim(); }
SEO note: "HTML to plain text" is often used for previews and snippets. Clean, readable output helps you generate better meta descriptions, app previews, and text-only summaries from the same source HTML.

FAQ

Does this remove scripts and styles?

When HTML is parsed as a document, textContent returns the textual content of the document body and does not include markup. In many cases, scripts and styles won't contribute meaningful text output.

Will the output preserve formatting?

Not exactly - plain text can't keep layout like HTML. You can add newlines between headings, paragraphs, and list items, and you can keep URLs as text if needed.

Why does my result have weird spacing?

Copy-pasted HTML often contains non-breaking spaces and empty nodes. Use the whitespace normalization example above, or run a cleanup step before converting.

What about converting to Markdown?

If you need readable formatting (headings, lists, links), Markdown may be a better target than plain text. Plain text is best when you want the simplest possible output.

Back to top