Zero Signup ToolsFree browser tools

Developer Tools

HTML Sanitizer

Sanitize HTML in your browser. Strip script tags, event handlers, and unsafe URLs with a clear allow-list and visible removal stats.

HTML Sanitizer

Allow-list preset

Sanitization runs entirely in your browser. The HTML you paste is never sent to a server.

Sanitized HTML

Could not parse the HTML: DOMParser is not defined

Options

Removal stats

Tags removed
0
Tags unwrapped
0
Attributes stripped
0
URLs blocked
0

Tags allowed by the standard preset

<a><abbr><address><article><aside><b><blockquote><br><cite><code><data><dd><dfn><div><dl><dt><em><figcaption><figure><footer><h1><h2><h3><h4><h5><h6><header><hr><i><img><kbd><li><main><mark><nav><ol><p><pre><q><s><samp><section><small><span><strong><sub><summary><sup><time><u><ul><var><wbr>

Inline event handlers (any attribute starting with on), script and style elements, iframes, forms, and links with javascript:, vbscript:, file:, or other unsafe schemes are always rejected, even when the preset would otherwise allow the surrounding tag. ARIA and data-* attributes are kept on every allowed tag.

How to use

  1. Pick a preset: Strict for plain inline formatting, Standard for blog content, or Permissive for rich documents with tables.
  2. Paste your HTML on the left. The cleaned output appears on the right as you type.
  3. Toggle options for unwrapping disallowed tags, keeping safe inline styles, allowing data: image URLs, and link rel hardening.
  4. Read the removal stats card to see what was stripped, then expand the details for a per-tag breakdown.
  5. Click Copy output to grab the sanitized HTML for your CMS, comment field, or email template.

About this tool

HTML Sanitizer strips dangerous markup out of an HTML snippet while keeping the structural tags you want to ship. Pick a preset that fits your use case: Strict for short messages and comments (inline formatting and line breaks only), Standard for blog-style content (headings, paragraphs, lists, links, images, code, quotes), or Permissive for trusted rich-text editors (Standard plus tables, captions, and details). Every preset always rejects script and style elements, iframes, frames, objects, embeds, base, link, meta, forms, and inline event handlers (any attribute beginning with on). URLs in href, src, action, formaction, poster, and similar attributes are parsed and only kept when they use a safe scheme (http, https, mailto, tel, sms, ftp, sftp, irc); javascript:, vbscript:, file:, and other unsafe schemes are blocked even when the scheme is obfuscated with leading control characters or whitespace. The Allow safe inline styles option keeps a curated subset of CSS declarations (color, font, spacing, borders, sizing, display) after dropping any value that contains url(), expression(), @import, or angle brackets. The Allow data: image URLs option keeps base64 image data URLs on img tags for PNG, JPG, GIF, WebP, AVIF, BMP, and ICO types (SVG is never allowed because it can carry script). For user-generated content, toggle Add nofollow to anchors, and the always-recommended Add noopener noreferrer to target="_blank" links to prevent tabnabbing. Every run reports how many tags it removed, how many it unwrapped (the inner text is kept, the tag is dropped), how many attributes it stripped, and how many URLs it blocked, with a per-tag breakdown so you can spot suspicious input. Parsing uses the platform DOMParser inside a detached document, never the live page, so script tags in your input are inert even before sanitization. Nothing is uploaded; the HTML you paste stays in this tab.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools