HTML to Plain Text
Convert an HTML fragment or document to plain text with a pure string tokenizer (no DOM). Script and style contents are dropped, block elements become line breaks, list items get a dash, and HTML entities are decoded.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
A tokenizer, not a browser
The conversion is one ordered pass of string rules: HTML comments go first, then script and style blocks with their contents, then the optional link and image rewrites, then structural tags become line breaks, and only afterwards are entities decoded. Nothing is rendered, no DOM is created and no script in the input ever executes, so the result is the same in a worker or a test as in the page.
How layout survives the trip
Structural tags map to whitespace rather than being dropped: <br> becomes a newline, each <li> starts a line prefixed with "- ", and closing p, div, h1–h6 and tr tags become a blank line. Runs of spaces and tabs collapse to one, lines are trimmed, and three or more blank lines shrink to one.
The two optional keepers
By default links contribute only their visible text and images disappear. Turning on keep link URLs rewrites <a href> as "link text (https://…)", and keep image alt text turns <img alt="…"> into "[alt text]". An image with an empty or missing alt still vanishes even with that option on.
What it will not decode
Numeric entities decode for any code point up to U+10FFFF, but named entities come from a fixed list, so an unrecognised name is left as written. Input over 500,000 characters is rejected rather than truncated, and an unclosed tag simply falls through the final strip step. The whole pass is local string work with no network request and no script execution.
Questions
Does it use the browser DOM parser?
No. It is a small pure-JS tokenizer, so it runs the same in a Web Worker or a test and never executes the HTML.
Which entities are decoded?
A common named set (& < © — …) plus every numeric entity, both decimal (©) and hex (©).
What happens to <script> and <style>?
Their contents are removed entirely before any text is extracted.
Related tools
See categoryMarkdown to HTML
Convert Markdown to HTML source code — see the generated markup, not a preview.
HTML Entity Encode / Decode
Escape text for safe insertion into HTML, or decode named and numeric entities.
XML Formatter
Pretty-print or minify XML with a pure-JS tokenizer — comments, CDATA and PIs kept intact.
SQL Formatter (basic)
Pretty-print a SQL query: keyword casing, clause line breaks, indented joins and columns.