ToolLineup

HTML Tag Stripper

This HTML tag stripper gives you control over exactly which tags go. Leave the list empty to remove every tag; name specific tags to remove only those; or invert the list to keep only the tags you name and strip everything else. There is also the choice between removing a tag while keeping what it wrapped, and deleting the element along with its entire contents — which is what you want for script, style, iframe and anything else whose content is not prose. Keeping a short allowlist such as b, i, em, strong, a, p, ul, ol, li is the usual way to reduce rich text to something safe to store and re-render.

How it works

Removes tags while keeping what they wrapped, or removes chosen elements along with their contents. Leave the tag list empty to strip every tag; fill it in to act on just those, or invert it to keep only those.

Keeping a short allowlist — b, i, em, strong, a, p, ul, ol, li — is the usual way to sanitise rich text down to something safe to store and re-render.

Everything runs in your browser — nothing you paste is sent to a server.

HTML input
Paste HTML here…
Stripped output

How to strip HTML tags

  1. Paste your markup into the input on the left.
  2. Leave the tag list empty to remove every tag, or name the tags you want to act on.
  3. Tick Keep these instead to invert the list into an allowlist.

Three modes, and when to use each

Remove everything — leave the list empty. Every tag goes and the text remains. Use this when you want content, not markup.

Remove specific tags — list them. Useful for targeted cleanup: stripping every <font> from a legacy page, or removing <span> wrappers an editor added.

Keep an allowlist — list the tags and tick Keep these instead. Everything else is stripped. A list like b, i, em, strong, a, p, ul, ol, li reduces arbitrary rich text down to a safe, predictable subset.

Stripping a tag versus deleting an element

By default the tag goes and its contents stay, so <b>hello</b> becomes hello. Tick Delete contents too and the whole element disappears — which is what you want for <script>, <style> and <iframe>, where the content is not prose.

Nesting is tracked properly when deleting. A <div> inside a <div> does not end the removal early and leave a stray closing tag behind.

This is cleanup, not a security boundary

An allowlist here is a genuinely useful step, but it is not a substitute for server-side sanitisation. If you are accepting HTML from users and rendering it back, run it through a maintained sanitiser on the server as well — client-side filtering can always be bypassed by not using the client.

Common use cases

  • Reducing pasted rich text to a safe subset before storing it.
  • Removing one troublesome tag from an otherwise fine document.
  • Stripping a page down to text while keeping its links.

Frequently asked questions

How do I strip HTML tags?

Paste your markup into the left panel. With the tag list empty, every tag is removed. Fill the list in to act on just those tags.

How do I keep some tags and remove the rest?

List the tags you want to keep and tick "Keep these instead". Everything not on the list is stripped, which is how you reduce rich text to a safe subset.

What is the difference between stripping a tag and deleting its contents?

Stripping removes the tag but keeps the text it wrapped, so <b>hello</b> becomes hello. Deleting removes the element entirely, contents included, which is what you want for script or style blocks.

Does it handle nested tags of the same name?

Yes. When deleting contents, nesting is tracked properly, so a <div> inside a <div> does not end the removal early and leave a stray closing tag behind.

Is this a security sanitiser?

It is a useful cleanup step, not a security boundary. If you are accepting untrusted HTML for display, sanitise it server-side with a maintained library as well — never rely on a client-side tool alone.

Is anything uploaded?

No. The markup is processed entirely in your browser.

Related tools