FileGizmo Text tools

Remove HTML tags from text

Turn copied HTML into readable plain text, with script and style contents removed rather than left behind as words. Headings and lists survive.

Never uploadedYour file stays on this device

Simple by design

Remove HTML tags in three steps

Copying text out of a rendered web page usually works. Copying the page source and trying to recover the text from it is where the trouble starts, and the usual approach makes a specific mistake worth understanding.

The obvious way to strip HTML is to delete everything between angle brackets. That removes the tags correctly and leaves behind everything that was not a tag, which includes the contents of script and style elements. Those contents were never inside a tag: they sat between an opening tag and a closing one, exactly like a paragraph does. So a saved page converted this way arrives as a wall of JavaScript and CSS selectors with the article buried somewhere in the middle, and the person doing the converting is left deleting it by hand.

FileGizmo uses the same converter that turns HTML into PDF and EPUB elsewhere on this site. It removes script, style, template, noscript and head elements with their contents rather than merely stripping their tags, so nothing that is not writing survives into the output.

Structure is preserved as far as it honestly can be. Headings, paragraphs and list items each become their own block, and list items keep a marker, so an ordered list stays numbered and a bulleted list stays bulleted. What is not preserved is stated plainly instead of being discovered later: a table comes out as its text rather than as a table, and a nested list is flattened to a single level. Anything positioned purely by CSS has no structure in the markup to recover.

Broken markup is expected rather than assumed away. Unclosed tags, stray angle brackets and mismatched nesting are common in anything copied out of an email client or a content management system, and none of them stop the conversion. An unterminated comment or an unclosed script tag leaves the remaining text alone rather than swallowing the rest of the document.

That tolerance is built on a scanner rather than a pattern, and the reason is performance rather than taste. The obvious expressions for finding comments and script blocks restart at every opening marker and read to the end of the input when no terminator exists, which makes the work grow with the square of the input. Measured on the earlier version, 39 KB of unclosed comments took 1.5 seconds and 156 KB took 24.7. The scanner does the same job in one pass.

Nothing is uploaded, nothing is rendered, and no resource in the markup is fetched.

  1. 1

    Paste HTML copied from a page or an email

  2. 2

    Choose whether blocks are separated by a blank line or one per line

  3. 3

    Press Remove the tags and copy or download the text

Good to know

Frequently asked questions

Why does removing tags with a pattern leave JavaScript behind?

Because a pattern that deletes everything between angle brackets deletes the script tags and keeps what was between them. The code was never inside a tag, it was inside an element, so it survives as text.

Is the document structure preserved?

Partly and honestly. Headings, paragraphs and list items come out as separate blocks with list markers intact. Tables are flattened to their text, and nested lists come out at one level.

Does it run the HTML?

No. Nothing is rendered, no script executes, and no resource referenced by the markup is fetched. The markup is read as text and converted.

Can it handle broken markup?

Yes. Unclosed tags and stray angle brackets are tolerated, and an unterminated comment or script leaves the remaining text alone rather than consuming the rest of the document.

Learn more

Related guides

Text guideWhy two strings that look identical do not matchA lookup fails, a duplicate slips through, a join returns nothing. Four invisible differences cause almost all of it, and they are worth checking in a fixed order.