The tool
What the Grok strip HTML tool does
Paste markup, press Strip HTML, and the tags come out while the text between them stays. A heading followed by a paragraph comes back as two lines of plain words with no angle brackets in them.
It runs in your browser. Nothing is uploaded, nothing is stored and there is no account. Press Try a sample to see it work on a short block of markup with a heading, a bold tag and a non-breaking space in it before you paste anything of your own.
There are no options. One button does one job, which is worth knowing because several competing strippers are built around a mode list and this one is not.
The difference
Script and style blocks go with their contents
This is the part that separates a usable stripper from a frustrating one. Removing a script tag is easy. Removing the JavaScript inside it is a separate rule, and not every tool has one.
A well-known stripper that publishes its implementation uses a single tag-matching pattern and states the consequence honestly: it removes the tags but not necessarily the text between them, so your output arrives with the JavaScript and the CSS still in it. Another tool offers content removal as an optional mode you have to select.
Here it is unconditional and it was tested. Paste text with a script block between two words and the output is the two words joined. The same applies to a style block: the rules inside it are gone, not left behind as a run of selectors and colours.
The steps
How to strip HTML from text in three steps
Three steps, and the last one is where you catch the cases a tag-matching rule cannot handle.
- Step 1
- Paste the markup into the left pane. There is no character limit, so a whole page source is fine where other tools cap you at twenty thousand characters.
- Step 2
- Press Strip HTML. The tool reports how many characters were removed or changed, which on a page of markup is usually most of them.
- Step 3
- Read the output for stray angle brackets. If a fragment like a quote mark or a closing comment marker survived, the source contained a greater-than sign inside an attribute or a comment, and that part needs a manual fix.
The detail
The four entities it decodes, and the ones it does not
Entity handling is where strippers differ most. One tool decodes twenty or more including numeric ones, another deletes entities entirely and sends you to a separate decoder, and a third leaves every one of them alone. This tool decodes exactly four.
- becomes a space
- The non-breaking space turns into an ordinary space, which is usually what you want when the markup is going to become prose.
- & becomes an ampersand
- The most common entity in a URL query string, restored to the character it stands for.
- < and > become angle brackets
- Escaped markup in the source comes back as literal angle brackets in the output. That output is text, not markup, but it will look like a tag.
- Everything else passes through
- Tested: ", ', © and all numeric entities survive exactly as written. If you need those decoded, that is a separate job this tool does not do.
The behaviour
What happens to line breaks and spacing
Nothing. The whitespace already in your source is preserved exactly, blank lines included. Three blank lines between two paragraphs come out as three blank lines.
The flip side is that a break tag leaves nothing behind. Some strippers convert block-level tags into newlines, either always or behind a checkbox. This one does not, so a paragraph tag or a line break tag is simply deleted like any other tag.
The practical consequence is worth planning for. Markup written on a single minified line comes back as a single line of text, because there were no newlines in the source to preserve.
The honest answer
Does the strip HTML tool sanitize markup?
No, and you should not use it as one. A tag-matching rule is a text cleaning step, not a security control, and the stripper that publishes its implementation says the same thing about itself in plain language.
There is a specific reason it is the wrong tool for that job here. Because the escaped angle brackets are decoded after tags are removed, markup that arrived safely escaped comes back with real angle brackets around it. That is fine when the destination is a text file and wrong when the destination is a web page.
If your input is untrusted and the output is going anywhere that renders, use a real sanitizer. This tool is for getting readable words out of markup you already trust.
The limit
Where a regex tag strip goes wrong
Every stripper in this category matches tags by pattern rather than parsing the document, and every one that publishes its mechanism admits the same weakness. One names the case where a less-than and a greater-than sign used as comparison operators get read as a tag.
Ours fails in the matching family of cases, and we tested them. An attribute whose value contains a greater-than sign is cut at that sign, so part of the attribute survives into the output. An HTML comment containing a greater-than sign leaves its tail behind.
These are uncommon in hand-written markup and more common in machine-generated pages. That is the reason for step three: a quick read of the output catches them, and nothing else will.
The users
Who uses the Grok strip HTML tool, and when
People who have markup and want the words. A page source, a chunk of email HTML, the contents of a rich text field, an export from a content system that wrapped everything in tags.
Writers use it to get a draft back out of a formatted editor without the formatting. Developers use it on a database field that stored markup it should not have. Anyone checking word count on a page uses it, because a word counter fed raw markup counts the tags.
It is the wrong tool when you want structure kept. Headings, lists and links all become undifferentiated text here, and if the destination needs them, a Markdown conversion is the job rather than a tag strip.