Clean Text · browser-local

HTML to Text

Convert an HTML snippet into clean plain text. GlyphSift removes script and style blocks, turns block elements into line breaks, separates table cells with tabs, keeps whitespace inside pre blocks, strips remaining tags, and decodes HTML entities in a single pass. It reads the markup as a string and never attaches it to the page.

Works on up to 5,000 characters and 20,000 code points per field (at most 64 code points per character), processed in your browser.

51 graphemes51 code points51 bytes

Live result

Output

Title
Hello world & more

Good fit

Use this tool when

  • You copied rich content and need plain text.
  • You want to remove markup from an email or page fragment.
  • You need a quick, safe tag strip without running the HTML.

Keep the original

Avoid it when

  • You need to preserve links, tables, or structure.
  • The source is a full document you must parse precisely.
  • You require sanitized HTML output rather than plain text.
01

Reviewed truth vectors

Examples that expose the edge cases

Input<p>Hello <b>world</b></p>
OutputHello world

Tags are removed; text is kept.

Input<p>Line 1</p><p>Line 2</p>
OutputLine 1 Line 2

Block elements become line breaks.

Input<script>alert(1)</script>Safe
OutputSafe

Script and style blocks are dropped, never executed.

02

Transparent implementation

How it works

  1. 01

    Tokenize the markup as a string and skip script and style bodies entirely.

  2. 02

    Turn br and block tags into newlines, table cells into tabs and rows into newlines, and keep pre text verbatim.

  3. 03

    Decode named and numeric entities once, so &amp;lt; stays the literal text &lt;, and collapse other whitespace.

03

Known limitations

What the result cannot promise

Links and images are not preserved; tables become tab-separated rows, not aligned columns.

&nbsp; becomes an ordinary space; entities outside the built-in table are left as written.

Malformed HTML may leave stray characters.

04

Questions before copying

Frequently asked questions

Is it safe to paste untrusted HTML?

Yes for extraction. Script and style blocks are removed and nothing is executed; the tool only manipulates strings.

Does it keep links?

No. Link markup is stripped and only the visible text remains.

Will it decode entities?

Numeric references and the Latin-1, Greek, typographic, and common math named entities are decoded in one pass. A double-encoded value such as &amp;lt; becomes the literal text &lt;, not a tag.

05

Testing and sources

How this tool is tested

GlyphSift Editorial — Text-engine notes written and reviewed by Hommer Zhao, Founder & General Manager

GlyphSift Editorial is the site's writing and review process, led by Hommer Zhao, who is accountable for every tool page and correction. Each tool's examples are written against real Unicode edge cases and checked against the engine before the page is published.

Each tool page is reviewed against the same six input classes the engine is tested with — ASCII, emoji, combining marks, non-Latin scripts, empty input, and 5,000-grapheme input — and cannot become eligible if it is only a parameter variation of another page.

Automated evidence

  • Tool-contract & coverage suiteShared suite · 37 cases across all tools it covers

    tests/tools-30.test.mjs mirrors the ToolRunner dispatch and asserts every registered engineId returns the contracted output shape, plus a coverage guard: every style keeps one output character per input character with unmapped characters passed through in place, and strikethrough, zalgo and upside-down never drop or split a grapheme cluster.

    Run in: node --test after a production build (vinext build)
  • Rendered-HTML suiteShared suite · 26 cases across all tools it covers

    tests/rendered-html.test.mjs renders the deployed server bundle and asserts the Unicode-version manifest and each wave's tool markup are present in the server-rendered HTML.

    Run in: node --test against the built dist/server bundle
  • Transform & cleanup suiteShared suite · 38 cases across all tools it covers

    tests/transform-cleanup.test.mjs exercises each deterministic cleanup and transform action against whitespace, duplicate, ordering, casing, and HTML-to-text edge cases.

    Run in: node --test, no network, no randomness

Standards this tool follows