HTML Purifier
PHP HTML filtering library that removes malicious code and guarantees W3C-compliant, XSS-safe HTML output.
About HTML Purifier
What is HTML Purifier?
HTML Purifier is a standards-compliant HTML filter library written in PHP that removes malicious code and ensures output documents comply with W3C standards. It offers attribute validation, XSS protection, full UTF-8 support and extensibility for advanced use cases.
Use cases
What is HTML Purifier for?
- A PHP application that accepts HTML from users (WYSIWYG editors, comments) and needs to sanitise it before storing.
- A content platform where XSS protection on user-submitted HTML is critical.
- A project that needs to guarantee W3C-compliant HTML output.
Benefits
Main benefits of HTML Purifier
Removes XSS malicious code from user-submitted HTML.
W3C standard compliance in the resulting HTML.
Full UTF-8 support for multilingual content.
Extensible for advanced use cases.
Is it for you?
Who should use HTML Purifier?
PHP developers who need to sanitise user HTML before displaying or storing it in the database.
Is HTML Purifier right for you?
Is HTML Purifier the right choice for you?
It's a great fit if…
- If your application accepts HTML from users and needs XSS malicious code removal.
- If you want to guarantee the stored HTML complies with W3C standards.
- If you handle multilingual content and need robust UTF-8 support.
It might not be for you if…
- If you don't accept HTML from users and only process plain text, where PHP's htmlspecialchars() is enough.
- If you need a full framework, as HTML Purifier is a purpose-specific library.
Installation
How to install HTML Purifier on your hosting
Open your hosting panel
Log into your miHosting professional hosting panel and open Softaculous, the application installer included with every plan.
Find HTML Purifier
Integrated into PHP projects as a library, included as a dependency and called at the points where user HTML is processed.
Configure and go live
Choose the domain, language and admin details. Softaculous creates the database automatically and your install is ready in minutes.
Recommended hosting
Why install HTML Purifier on miHosting
miHosting's professional shared hosting includes Softaculous, PHP and databases already configured, NVMe storage with no artificial limits, free SSL and real technical support if you need help during installation or maintenance of HTML Purifier.
Choose your plan
Install HTML Purifier today
Choose the professional hosting plan that best fits your HTML Purifier project, or try it risk-free with the free plan.
Emprendedor
50% OFF118 $/yr 59 $/yr — free domain included
- ✓3 websites
- ✓1 free domain for the first year
- ✓Unlimited NVMe SSD storage
- ✓Softaculous — 400+ one-click apps
- ✓Free, automatic SSL (Let's Encrypt)
- ✓Free migration included
- ✓Real 24/7 technical support
Plus
50% OFF170 $/yr 85 $/yr — free domain included
- ✓15 websites
- ✓1 free domain for the first year
- ✓Unlimited NVMe SSD storage
- ✓Softaculous — 400+ one-click apps
- ✓Free, automatic SSL (Let's Encrypt)
- ✓Free migration included
- ✓Real 24/7 technical support
Webmaster
50% OFF198 $/yr 99 $/yr — free domain included
- ✓100 websites
- ✓1 free domain for the first year
- ✓Unlimited NVMe SSD storage
- ✓Softaculous — 400+ one-click apps
- ✓Free, automatic SSL (Let's Encrypt)
- ✓Free migration included
- ✓Real 24/7 technical support
Not sure which to choose?
For 1–3 of your own websites, the Emprendedor plan is more than enough. To manage client sites or multiple projects, the Webmaster plan is the go-to choice for agencies and freelancers.
Talk to a technician on WhatsApp →Not ready to commit yet?
Try it with the same NVMe infrastructure as the paid plans, no credit card and no fine print. When you're ready, upgrade to a professional plan with a 50% discount.
- ✓ No credit card required
- ✓ Softaculous included
- ✓ Upgrade whenever you want
Frequently asked questions about HTML Purifier
Does HTML Purifier protect against XSS attacks?
Yes, that's its main purpose: removing malicious JavaScript and other XSS vectors from user-submitted HTML.
Is HTML Purifier compatible with any PHP project?
Yes, it's a standalone library that can be integrated into any PHP project, with or without a framework.
Launch your project with HTML Purifier today
Professional hosting with Softaculous, real technical support and a 60-day money-back guarantee.