H
HTML Sanitizer XSS-Safe Content Cleaner
Published byForcom APIs
10/21/2026
Rendering user-submitted HTML without sanitization is how XSS happens. Send any HTML string and get back a cleaned version:
- **Removes**: script tags, event handlers (onclick=…), javascript: URLs, iframes and other injection vectors
- **Keeps**: legitimate formatting — paragraphs, bold/italic, links (with rel="noopener noreferrer" added), lists, headings
- **Reports**: the removedTags list, whether anything changed, and before/after lengths — audit-log friendly
**Use cases:** comment sections, CMS/rich-text pipelines, email HTML ingestion, anywhere user HTML touches your DOM.
Last updated 2026-10-21