Scripts & Templates

HTML Purifier

A filter that cleans user-submitted HTML so it can't be used to attack your site.

Pass it on: WhatsApp
Added
Oct 31, 2026
Source
htmlpurifier.org

If you let people post comments or content with formatting, you need to strip out anything dangerous. HTML Purifier removes harmful scripts while keeping safe tags like bold and links.

What you can do with it

  • Accept formatted comments or posts safely
  • Block cross-site scripting (XSS) attacks
  • Choose exactly which tags and attributes are allowed

Good to know

It's thorough but a bit slow, so clean content once when it's saved, not every time it's shown.

Was this helpful?