Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

HTML Purifier

Security covered Maintenance fixes only 2,807 sites

HTML Purifier is a library that cleans HTML content to remove malicious code like XSS and ensure it's standards-compliant. It can be configured to allow or restrict specific HTML elements and attributes, making it a more robust alternative to Drupal's built-in filtering.

HTML Purifier is a standards-compliant HTML filter library. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C's specifications.

HTML Purifier is very tasty when combined with WYSIWYG editors and is more comprehensive, standards-compliant, permissive and extensive than Drupal's built-in filtered HTML option, which uses a derivative of kses. You can read more about it at this comparison page. Want custom fonts, tables, inline styling, images, and more? Want just a restricted tag set but bullet-proof standards-compliant output? HTML Purifier is for you!

The HTML Purifier module is licensed under GPL v2 or later, however, the HTML Purifier library itself is licensed under LGPL v2.1 or later.

Want to give it a test drive? Try it out on simplytest.me.

Install the module using composer:
composer require 'drupal/htmlpurifier:^1.0'

Enable it and configure the filter for each text format in Administration - Configuration - Text formats and editors (admin/config/content/formats).

You can use the HTML Purifier Configuration Documentation as reference to learn and edit the configuration settings available in YAML format within the filter settings form textarea.

Drupal 10–11

Ask your assistant about HTML Purifier

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • filter Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Oct 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.2 Stable 10–11 Dec 12, 2024
8.x-1.1 Stable 10–11 Nov 8, 2024
8.x-1.0 Stable 8–10 PHP 7.1 Oct 9, 2023