AI Tools Free

HTML Sanitizer

Remove scripts and event handlers from HTML while keeping basic text, lists, tables and links. Review the cleaned source and contained preview, then copy or download the fragment.

Free to useNo sign-upRuns in your browser
Enter your details

Enter the inputs, then select Sanitize HTML.

Your result
Enter your details

Result will appear here

How HTML Sanitizer works

DOMPurify keeps an allowlist of basic HTML tags and link attributes and removes active or unsupported content.

This page keeps text formatting, lists, tables and links. Images, CSS, forms, embedded content and event attributes are removed. The preview cannot execute scripts or load external resources. Sanitizing a fragment does not replace context-specific security checks in your own application.

Concept diagram showing HTML input and allowed html output.
Concept diagram; the operation screenshots show the implemented tool.

How to use HTML Sanitizer

Paste an HTML fragment, apply the basic allowlist, and compare retained markup before taking it to another application.

Paste the HTML fragment

Include the text, list or table markup you want to keep. This basic policy removes images, CSS, forms and active content.

Input and settings
HTML Sanitizer: input and settings in the implemented browser tool
Actual local browser view. Open the image to read it at full size.

Sanitize HTML

Select Sanitize HTML to remove scripts, event handlers, images, CSS and other unsupported markup. The result keeps the basic tags and link attributes allowed by this page.

Tool result
HTML Sanitizer: tool result in the implemented browser tool
Actual local browser view. Open the image to read it at full size.

Review and copy the cleaned HTML fragment

Compare the cleaned source and contained preview. Copy the fragment or download the HTML for a separate application review.

Review the details
HTML Sanitizer: review the details in the implemented browser tool
Actual local browser view. Open the image to read it at full size.

Clean pasted HTML for basic text and table markup

Prepare basic markup for a destination with its own HTML policy.

Review pasted article markup

Keep paragraphs, headings and links from a pasted fragment while removing its unsupported attributes and active elements.

Developer input and configuration represented by document cards.
Prepare the input. Concept illustration.

Reduce a fragment to basic formatting

Prepare simple text, lists or tables for a destination that accepts basic HTML. Check that the destination permits the same tags.

A developer example flowing from input to reviewed output.
Inspect an example. Concept illustration.

Inspect removed attributes

Try a small fragment with a style or event attribute and compare the returned source. This is a policy demonstration, not a security certification.

Developer output handed to the next stage of a workflow.
Use the result in your workflow. Concept illustration.

Allowed HTML tags and removed attributes

Compare the cleaned source with the preview to see what the basic HTML policy retained.

Read the returned HTML as the result of this page's allowlist. Removed images, CSS and attributes will not appear in the output.

A developer result reviewed alongside its source.
Review the returned output. Concept illustration.

HTML sanitizing limits and application context

A fragment accepted by this allowlist still needs checks for its destination and insertion context.

The text input is limited to 100,000 characters. A fragment that needs images, styles, forms or embedded content cannot retain them under this basic policy; review the permitted markup before replacing the source.

The preview blocks scripts and external resource loading. It illustrates retained formatting, while application-level sanitization, URL policies and the eventual insertion context still need separate review.

Input format and assumptions reviewed for a developer task.
Check format and assumptions. Concept illustration.

Sanitize HTML with your own input

Remove scripts, event handlers and unsupported markup from basic HTML. Review the cleaned fragment and a contained preview.

Sanitize HTML

HTML Sanitizer: common questions

Answers about using HTML Sanitizer and understanding its results.

Will my stylesheet remain?

No. Style elements and style attributes are removed by this basic HTML policy.

Does the preview execute my HTML?

The preview renders allowed markup in a sandbox with scripts and resource loading disabled.