HTML Tag Remover

[ PLAIN TEXT ]
Hello Some markup & an entity.
10 tags removed
Tags removed10
Characters30
Stripping tags is not sanitising. This turns markup into plain text; it does NOT produce markup that is safe to insert into a page. If you are removing HTML for security, use a real sanitiser on the server that owns the output.
Script, style and SVG elements had their CONTENTS removed as well as their tags. Removing only the tags would leave a page of CSS and JavaScript in the middle of the text.
[ WHAT THIS IS ]

One thing on this page is worth reading: stripping tags is not sanitising. It turns markup into plain text; it does not turn text into markup that is safe to insert into a page. Those are different jobs, and the second needs a real sanitiser on the server.

Block elements become line breaks. Without that, every paragraph runs together into one continuous line — the commonest complaint about tools that do this.

The contents of script and style go too, not just their tags. Removing only the tags leaves CSS and JavaScript sitting in the middle of your text.

And entities are decoded last. Decoding first would turn <script> into a live tag — creating markup out of text that was deliberately escaped.

[ QUESTIONS ]

Can I use this to make user input safe to display?

No, and this is the one thing worth reading on this page. Stripping tags turns markup into plain text; it does not produce markup that is safe to insert into a page. Those are different jobs and the second one needs a real sanitiser running on the server that owns the output. If you are removing HTML for security reasons, this is the wrong tool.

Why did my paragraphs end up on separate lines?

Because block elements become line breaks. Removing tags without them runs every paragraph, list item and table row together into one continuous line, which is the commonest complaint about tools that do this. Inline elements like span and em do not break.

What happens to script and style contents?

They go entirely, not just their tags. Removing only the tags would leave a page of CSS rules and JavaScript sitting in the middle of your text, which is never what “remove the HTML” means. An unclosed script element takes the rest of the input, which is what a browser does too.

What is the difference between stripping and escaping?

Stripping removes markup so the text reads as text. Escaping converts the markup characters into entities so the text DISPLAYS as markup — useful when you want to show someone a code sample. They are opposite operations and this page does both.

Why does escaping do the ampersand first?

Because every other replacement introduces one. Escape the less-than sign first and you get <, then escaping ampersands turns that into < — the classic double-escape. The ampersand has to go first or the output is wrong in a way that looks almost right.

Why decode entities after stripping rather than before?

Because decoding first would turn <script> into a live tag — creating markup out of text that was deliberately escaped, which is the exact opposite of the job. Decoding happens last, on what is left.

[ THE MATHS ]
The order
1. Script, style, SVGcontents as well
2. Commentsentirely
3. Block elementsbecome line breaks
4. Every remaining tagremoved
5. Entitiesdecoded last

Repeated until nothing more is found. <scr<script>ipt> leaves a live tag behind when the pattern runs only once.

[ THE AMPERSAND GOES FIRST ]

When escaping, the ampersand is replaced first. Do < first and the &lt; it produces becomes &amp;lt; — the classic double-escape.

[ NEXT ]
55Text RedactorHide values rather than markup
51Word & Character CounterCount what is left after the tags go
43JSON FormatterThe other format that needs tidying
57URL Encoder & ParserThe other kind of escaping
[ IMPORTANT ]

Runs entirely in your browser. Stripping tags is not sanitising — this produces plain text from markup, not markup that is safe to insert into a page. For security, use a real sanitiser on the server that owns the output. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.