HTML extraction

Convert HTML to readable text without keeping script content

Removing angle brackets is not enough to convert HTML into readable text. Scripts and styles can leak into the result, block elements can run together, entities can remain encoded, and list items can lose their boundaries.

TextClean uses a small extraction pipeline for pasted markup. It is designed for readable plain text, not for making untrusted HTML safe to display as HTML.

Before

<p>Hello &amp; welcome</p><script>alert(1)</script><p>Next</p>

After

Hello & welcome

Next

Discard non-content blocks first

Script, style, and template blocks can contain code or hidden fragments that do not belong in the visible text. Comments are also removed. Doing this before generic tag removal prevents their contents from being mistaken for prose.

This is extraction for copied material. It is not a complete HTML sanitizer and should not be used to render untrusted markup back into a page.

Preserve readable boundaries

Line-break tags become newlines. Closing paragraphs, headings, sections, list containers, table rows, and similar block elements create paragraph separation. List items receive a visible bullet before the remaining tags are removed.

The output may contain extra blank lines after malformed or deeply nested markup. The normal spacing pass collapses repeated blank lines without merging every paragraph.

Decode entities deliberately

HTML entities represent characters that would otherwise be ambiguous in markup. The extractor decodes common named entities and valid decimal or hexadecimal numeric references. Unknown named entities are preserved instead of guessed.

A non-breaking space is decoded as a real special space. It can then be inspected or normalized through the separate Unicode controls.

Know what is lost

Plain-text extraction cannot preserve CSS layout, interactive controls, embedded media, visual columns, or every table relationship. Links can lose their destinations when only their visible labels are retained. If those features matter, use a structured parser and review the resulting document.

Keep the source HTML and compare headings, lists, links, numbers, and table rows before publishing the extracted text.

Check before using the result

  • Script and style content is absent
  • Paragraph and list boundaries
  • Decoded entities
  • Required link destinations
  • Tables and generated content

Open HTML to text