gptcleanuppro.com / grok-strip-html
Ready · local0w
Works with text copied from
ChatGPTClaudeGeminiGrokCopilotPerplexity
transmitted, execution is local
0 bytes
applied in fixed order
4 rules
decoded, all others literal
4 entities

Definition

What a strip HTML rule set can guarantee

This route applies four substitutions in a fixed order and nothing else. Script elements are removed with their contents, style elements are removed with their contents, any remaining angle-bracket sequence is removed, and four named entities are resolved to characters. There is no configuration surface, so the behaviour is total and can be documented rather than characterised.

That determinism is the argument for the route. A tool with six modes has six behaviours and usually documents none of them precisely. A tool with one behaviour can publish it, and a reader can predict the output before pressing anything.

Execution is local. The markup is processed in the page and nothing is transmitted, which is a consequence of where the code runs rather than a retention policy, so it holds without qualification.

Mechanism

The four rules, in the order they run

Order is not incidental here. Two of the observable behaviours below exist only because of where a rule sits in the sequence, and each was confirmed against the engine rather than inferred.

First, script elements
Matched from the opening tag to the closing tag and removed with everything between. JavaScript does not survive into the output, which is the behaviour a single tag-matching pattern cannot provide.
Second, style elements
The same treatment. Declarations, selectors and colour values are eliminated rather than exposed as loose text.
Third, remaining markup
Every remaining angle-bracket sequence is deleted. Self-closing tags, unclosed tags and ordinary comments all fall to this rule, and so does the entire attribute list of each element.
Fourth, four entities
The non-breaking space resolves to an ordinary space, and the ampersand, less-than and greater-than entities resolve to their characters.
The ordering consequence
Because entity resolution runs last, escaped markup in the source is un-escaped in the output. Text containing an escaped script element returns carrying literal angle brackets. It is text, not markup, and it is the reason this is not a sanitizer.

Procedure

How to strip HTML in three steps

The procedure is short because the transformation is. The third step exists because pattern matching has a known and reproducible failure class.

Step 1
Submit the complete source. No length constraint is imposed by the input field, so segmenting a document is unnecessary here even where a capped competitor would require it.
Step 2
Execute and read the reported figure. It is the difference in character count between input and output, not a tally of elements removed, and the two diverge sharply on attribute-heavy markup.
Step 3
Inspect the output for residue. A surviving quotation mark, attribute fragment or comment terminator indicates a greater-than character inside an attribute value or a comment, which is the documented failure below.

Scope

Entity resolution, precisely four

Competing implementations diverge more on entities than on tags. One resolves twenty or more including numeric references. One deletes entity sequences outright and refers the user to a separate decoder. One preserves every entity undecoded and documents that as intentional.

This route resolves four and preserves the remainder verbatim. Testing confirms the exclusions individually: the quotation entity, the numeric apostrophe reference and the copyright entity all emerge exactly as written. No numeric reference of any form is resolved.

The narrow scope is defensible in one direction only. Four resolutions cover the cases that make output unreadable as prose, and a reader who requires full entity decoding should treat it as a second operation rather than assume this route performs it.

Invariant

Whitespace is preserved exactly

No rule in the sequence touches whitespace. Spacing, indentation and blank-line runs present in the source are present in the output unchanged, and no rule inserts a newline anywhere.

Two competing tools convert block-level elements into line breaks, one unconditionally and one behind a checkbox. This route does neither, so a break element or a closing paragraph element is deleted like any other markup and contributes nothing to the layout of the result.

The consequence is predictable and should be planned for: minified input produces single-line output, because there were no newlines in the source to preserve. Reflowing text is a separate operation on a separate route, and combining the two would make a single action perform two transformations.

The objection

Does a strip HTML pass sanitize anything?

No, and the claim should be rejected rather than hedged. The most candid implementation in this result set states explicitly that it is not recommended as a sanitizer for untrusted HTML, and the reasoning transfers without modification.

Here the case against is stronger than elsewhere, because of rule four. A sanitizer escapes markup so it cannot execute. This route resolves escaped markup back into literal angle brackets, which is the inverse operation. Input that arrived safe leaves markup-shaped.

The correct boundary: use this when the destination is a text file, a word count, a spreadsheet field or a draft. Use a parser-based sanitizer when the destination renders and the input is not under your control.

Known failure

The failure class of pattern-based tag matching

This route matches markup by pattern rather than constructing a document tree, in common with every hosted tool in the category. Each competitor that publishes its mechanism concedes the same limitation, one of them illustrating it with a comparison expression being misread as an element.

Ours was tested rather than asserted. An attribute value containing a greater-than character terminates the match at that character, leaving the remainder of the attribute in the output. A comment containing a greater-than character leaves its terminator behind.

Incidence depends on provenance. Hand-authored markup rarely triggers it; generated templates and minified documents trigger it more often. The page documents the class instead of claiming robustness, because a claim of parser-grade correctness would be false.

Application

Who uses a Grok strip HTML tool, and for what

The characteristic case is recovering the text layer of a document whose markup is no longer wanted. A page source, an email template, a rich-text column, an export whose formatting is an artefact of the system that produced it.

Engineers apply it to stored fields that captured markup unintentionally and to fixtures required as plain text. Editors apply it before counting words, since a counter given raw markup counts element names. Analysts apply it to normalise a column before comparison.

The misapplication is expecting a structured document back. What returns is the text in document order with no indication of which span was a heading, a caption or a list item. Where that distinction matters, a Markdown conversion is the operation, not a tag strip.

FAQ

The strip HTML route in detail

All answered in full, nothing to click open.

What exactly does the route remove?

Script and style elements with their contents, then every remaining angle-bracket sequence, leaving the text that was between elements.

Is processing local?

Yes. The transformation runs in your browser, so no markup is transmitted and nothing is retained.

Is there a usage limit?

None. No account, no cap and no metering on this route.

Is there an input length cap?

No. The input field imposes no maximum, so a complete page source can be submitted in one pass.

Is JavaScript removed or exposed?

Removed. Script elements are eliminated with their contents, which a single tag-matching pattern cannot achieve.

How are style blocks handled?

Identically to script blocks. Declarations and selectors are eliminated rather than emitted as loose text.

Which entities are resolved?

Exactly four: the non-breaking space, the ampersand, and the less-than and greater-than entities. Everything else is preserved verbatim.

Are numeric character references resolved?

No. No numeric reference of any form is resolved by this route.

Why does escaped markup return with real brackets?

Because entity resolution runs after tag removal. The output is text, but it carries literal angle brackets, which is why this is not a sanitizer.

Is whitespace modified?

No. Spacing, indentation and blank-line runs are preserved exactly, and no newline is ever inserted.

Do block elements become line breaks?

No. A break or closing paragraph element is deleted like any other markup and contributes nothing to layout.

Why is my output a single line?

Because the input was a single line. Existing whitespace is preserved and none is created.

Can this sanitize untrusted input?

No. It is a text transformation, not a security control, and rule four works against that use.

Are HTML comments removed?

Ordinary comments are. A comment containing a greater-than character leaves its terminator behind, which is the documented failure class.

Why did an attribute fragment survive?

The attribute value contained a greater-than character, ending the match early. This case requires manual correction.

Are link addresses retained?

No. The anchor element is removed with its attributes, so only the link text survives.

Are there modes or options?

None. One action with one documented behaviour, in contrast to implementations organised around a mode list.

Can it emit Markdown?

No. Structural distinctions are discarded here. Markdown conversion is a separate route on this site.

Are file upload and download supported?

Neither. Markup is pasted into the page and text is copied out of a read-only pane.

What does the reported figure represent?

The difference in character count between input and output, which is not a count of elements removed.

Does the origin of the markup matter?

No. The rules match syntax rather than provenance and behave identically regardless of what produced the document.

Four rules, published, in order.

Script and style contents eliminated, markup removed, four entities resolved, whitespace untouched. Executed locally with nothing transmitted.

Run the strip