HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only acheivable with a comprehensive knowledge of W3C's specifications.
Features:
Remove Foriegn Tags Validates Attributes Fixes Nesting Standrds Safe UTF-8 Aware Object-Oriented Validates CSS Unit Tested