gptcleanuppro.com / strip-html
Ready · local0w
Works with text copied from
ChatGPTClaudeGeminiGrokCopilotPerplexity
passes, in a fixed order
4
entities decoded, no more
4
uploaded, it runs locally
0 bytes

The transform, in order

What the strip HTML operation actually executes

Four substitutions applied in sequence, and the sequence is load-bearing. Script blocks are removed with their contents. Style blocks are removed with their contents. Every remaining tag is deleted wherever it appears, opening or closing, and nothing is put in its place. Then four entities are decoded.

Publishing the order is not decoration. Two of the behaviours on this page follow from it and from nothing else, and a reader who knows the order can predict the output of any input without running it. That is the property a deterministic tool should offer and most pages on this term do not.

Pass 1
Script elements, opening tag through closing tag, contents included. Nothing of the JavaScript reaches the output.
Pass 2
Style elements, treated identically. CSS does not survive.
Pass 3
Any remaining angle-bracketed construct is deleted and replaced with nothing at all. Text between tags is untouched, and so is whitespace outside them.
Pass 4
Exactly four entities decoded: non-breaking space to a space, then ampersand, less-than and greater-than to their characters.

Consequence one

Nothing is inserted where a block element ended

Pass three deletes and does not substitute, so block structure is not converted into line breaks. Two adjacent paragraphs written with no whitespace between the tags emerge as a single run of text with no separator. This is the most consequential difference between this engine and the two tools on this term that discuss the question, both of which offer a block-to-newline option.

The mitigation is structural rather than optional. Whitespace outside tags passes through untouched, so any source that was formatted with newlines between its tags retains exactly that line structure. The failure case is narrow and identifiable in advance: minified markup, a single-line database field, or HTML pasted out of a log. For those inputs the paragraph boundaries are genuinely absent from the output and have to be restored by hand.

The stated ceiling

Four entities, and what that excludes

Non-breaking space, ampersand, less-than, greater-than. Everything else is left as literal text: the quotation and apostrophe entities, copyright, euro, every numeric and hexadecimal reference, and the entire long tail of named entities.

For comparison, one tool on this term claims more than twenty named and numeric entities and names copyright and euro among them, while another strips entities rather than decoding them and directs the reader to a separate decoder. Neither position is wrong. What would be wrong is implying a coverage this engine does not have, since the discrepancy surfaces on the first copyright symbol a user pastes.

Procedure

How to strip HTML tags in three steps

There is no configuration, so the judgement happens after the output exists.

Step 1
Establish whether the source is formatted or minified, because that single property determines whether paragraph structure survives.
Step 2
Run the pass. Execution is local, with no upload, no network request and no length ceiling to work around.
Step 3
Inspect for the four known residues: joined text, undecoded entities, decoded escaped markup, and title text at the head of the document.

Consequence two

Escaped markup decodes into visible angle brackets

Because entity decoding is pass four and tag removal is pass three, an escaped tag in the input is invisible to the stripper and then made visible by the decoder. A document containing escaped markup produces output containing literal angle brackets where that markup was.

This is correct rather than incidental. Escaped markup in a source document is nearly always content: a code sample in a tutorial, an example in API documentation, a snippet quoted inside a support article. Treating it as content preserves the author's meaning. It does mean that a double-escaped document requires two runs, and that the second run will remove what the first run revealed, which is worth knowing before you conclude that the tool is inconsistent.

Where it degrades

This is regex matching, not HTML parsing

The pass recognises angle-bracketed constructs by pattern, not by grammar. On well-formed markup the two approaches agree. On malformed markup they do not, and the disagreement is not always predictable. A comment containing a greater-than sign terminates the match early and leaves a fragment. An attribute value containing a greater-than sign does the same. Head content is not special-cased, so title text passes into the output like any other text node.

One competing tool states the same limitation about its own implementation in almost these words, and another concedes that it is not completely reliable because applications produce different markup. Both are being accurate. A regex tag strip is an excellent text utility with an identifiable degradation curve, and pretending otherwise would be the only real error available here.

Answered straight

Stripping HTML is not a sanitisation control

One of the pages competing for this term frames the use case around users injecting markup into comment fields. The concern is legitimate and the instrument is wrong. Everything in the preceding section is a reason: pattern matching on angle brackets degrades on exactly the malformed input an attacker constructs deliberately.

Sanitisation requires a parser that builds a tree, an explicit allow-list of elements and attributes, and enforcement at the point the content is rendered. None of those properties is present in a four-substitution text transform, and none of them can be added to one. This route is for reading documents.

Where it belongs

Where the strip HTML step earns its place

First in a text pipeline. Every downstream operation is cheaper once markup is gone: a word count no longer counts attributes, a hidden-character scan no longer wades through tag internals, a whitespace pass has ordinary text to work on. Content migrations, CMS exports, newsletter source and scraped article bodies are the routine inputs.

It does not belong anywhere a guarantee is required. Not as a security boundary, not as a converter between formats, and not as a substitute for a parser where a parser is what the situation needs. Within its actual scope it is deterministic, local, unlimited, and fully described by the four passes at the top of this page.

FAQ

Strip HTML, answered precisely

All answered in full, nothing to click open.

What exactly does the strip HTML pass remove?

Script and style elements with their contents, then every remaining tag. Text between tags and whitespace outside tags are untouched.

Is it free and is there a limit?

Free, with no account and no length ceiling, because the transform runs locally rather than on a server.

Is anything uploaded?

No. Execution happens in the browser and the input never leaves the device.

Are block elements converted to line breaks?

No. Tags are deleted and nothing is substituted, so block structure is not preserved as newlines.

Then why did my formatted HTML keep its line breaks?

Because whitespace outside tags passes through untouched. Those newlines were already in the source.

Which entities are decoded?

Four: non-breaking space to a space, plus ampersand, less-than and greater-than.

Are numeric or hexadecimal entities decoded?

No. Only those four named entities are handled, and everything else remains literal text.

Why does escaped markup appear in the output?

Entity decoding runs after tag removal, so an escaped tag is invisible to the stripper and then decoded into visible angle brackets.

How do I flatten a double-escaped document?

Run the pass twice. The second run removes what the first run revealed.

Are comments removed?

Ordinary comments are. A comment containing a greater-than sign terminates the match early and leaves a fragment.

Why is the page title in my plain text?

Head content is not special-cased, so title text is treated as any other text node and survives.

Does it use a real HTML parser?

No. It is pattern-based substitution, which agrees with a parser on well-formed markup and diverges on malformed markup.

Can I use it to sanitise untrusted input?

No. Sanitisation needs a parsing tree, an allow-list and enforcement at render time, none of which a text transform provides.

Are hyperlinks preserved?

No. Anchor tags are removed with their attributes, leaving only the link text.

Can it produce Markdown?

No. Output is plain text with no structural markup of any kind.

What happens to attribute values?

They are inside the tag and go with it. Alt text and title attributes do not survive.

What is the reported count after a run?

The difference between input and output length, reported as characters removed or changed.

What is the right next step after stripping?

A whitespace pass for minified sources, an entity decoder for heavily escaped ones, and a hidden-character scan for anything that passed through a chat interface.

Can I submit a file instead of pasting?

No. The route takes pasted text.

How does this differ from the markdown stripper?

That route removes markdown syntax such as hashes, asterisks and bracketed links. This one removes HTML tags.

Is the output deterministic?

Yes. The same input produces the same output every time, which is why the four passes can be published in full.

Run a transform you can predict

Four passes in a fixed order, four entities decoded, nothing inserted where a tag was, and nothing uploaded. Paste any amount of markup.

Strip HTML tags