ETEvoraTools
Markdown & Document Tools

HTML to Plain Text

HTML to Plain Text removes script and style blocks, turns br and selected closing block tags into newlines, strips other tags, decodes six common entities, and collapses excessive blank lines. It does not run the browser's HTML parser, preserve alt text, resolve CSS-generated content, or reproduce visual reading order.

Runs locally — files stay on your device
Quick answer

Is stripping HTML tags equivalent to extracting what a browser displays?

No. Browser parsing, CSS, accessibility names, hidden content, images, tables, and generated text can make rendered output differ.

Plain-text extraction requires a reading-order policy

HTML markup separates structure from text. Converting it to linear text requires choices about block boundaries, hidden elements, alternatives, and malformed markup.

How it works

The tool removes script/style ranges, inserts newlines for br and selected closing tags, deletes remaining angle-bracket tags, decodes common named entities, and trims whitespace.

Key concepts

Source order is not always visual order

CSS layout can rearrange or hide content.

Entity coverage is limited

Only nbsp, quot, #39, gt, lt, and amp are decoded.

When to use it

  • Clean a simple controlled HTML fragment.
  • Remove visible tags for notes.
  • Extract basic paragraph text locally.

When not to use it

  • Do not use it for faithful web-page accessibility text.
  • Do not treat it as sanitization.
  • Do not expect tables, image alternatives, or malformed markup to preserve reading order.

Worked examples

Paragraphs

Input
<p>One</p><p>Two</p>
Expected output
One\nTwo

Closing paragraphs add line boundaries.

Script

Input
<script>alert(1)</script><p>Hello</p>
Expected output
Hello

The script block is removed.

Image alternative

Input
<img alt="Chart" src="x">
Expected output
Empty

Alt attributes are not extracted.

Common mistakes

Assuming visible-page fidelity

No DOM or CSS computation occurs. Correction: Use browser-based extraction where layout semantics matter.

Calling output sanitized HTML

The result is text, and downstream interpretation still matters. Correction: Escape it for any later markup context.

Expecting every entity decoded

The decoder handles only a short list. Correction: Use a standards-compliant entity decoder.

Best practices

  • Use controlled fragments.
  • Review table and list boundaries.
  • Escape plain text when inserting it into HTML later.

Related operations and differences

Document Link Extractor

Choose Document Link Extractor when you need to extract labeled links from Markdown or HTML.; use HTML to Plain Text specifically for html text.

HTML to Markdown Converter

Choose HTML to Markdown Converter when you need to convert common HTML elements into clean Markdown.; use HTML to Plain Text specifically for html text.

Markdown to HTML Converter

Choose Markdown to HTML Converter when you need to convert Markdown headings, emphasis, links and lists to HTML.; use HTML to Plain Text specifically for html text.

ASCII Table Generator

Choose ASCII Table Generator when you need to turn CSV rows into an aligned plain-text table.; use HTML to Plain Text specifically for html text.

CSV to Markdown Table

Choose CSV to Markdown Table when you need to turn comma-separated rows into a Markdown table.; use HTML to Plain Text specifically for html text.

Document Word Statistics

Choose Document Word Statistics when you need to measure words, characters, lines and reading time.; use HTML to Plain Text specifically for html text.

Limitations and privacy

  • Regex-style stripping rather than DOM parsing.
  • Limited entity set and block tags.
  • No alt text, CSS, accessibility tree, or generated content.

Document text is transformed locally in this browser.

Frequently asked questions

Are script blocks removed?

Simple paired script blocks are removed.

Is CSS reading order used?

No.

Is alt text retained?

No.

Is this an HTML sanitizer?

No.

References