FindSoftware

sanitize-html

JavaScript library that cleans user-submitted HTML, keeping allowlisted elements and attributes and discarding the rest.

sanitize-html is a JavaScript library that cleans user-submitted HTML. A caller lists the tags and the attributes per tag to permit, and the library discards the rest. The README names HTML from rich text editors, including CSS pasted from Word, as typical input.

The 2.x line no longer ships a build for the browser, so browser use means including the package in the project’s own bundle.

Worth knowing

The standalone repository is archived and points to the monorepo, where the package sits in its packages/sanitize-html directory. The README’s Node.js support statement is older than the requirement in the published package.

Identity

Status
Active
Maintainer
P'unk Avenue LLC3
Maintained by
Company
First release
20136

Rendering and deploy

Install with
npm2

Releases

Current major version
27
Last release
2026-11-116

Adoption

GitHub stars
4,6691
npm downloads a week
18,174,4909
Contributors
1018
Dependent repositories
89,98510
Dependent packages
1,49510

Why these figures do not compare

Sources

  1. 2026-11-16: links, Written in, GitHub stars
    api.github.com/repos/apostrophecms/apostrophe
  2. 2026-11-16: links, Categories, Runtime, Install with
    raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/README.md
  3. 2026-11-16: Maintainer
    raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/LICENSE
  4. 2026-11-16: Minimum runtime
    registry.npmjs.org/sanitize-html/latest
  5. 2026-11-16: License, License model
    raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/package.json
  6. 2026-11-16: First release, Last release
    registry.npmjs.org/sanitize-html
  7. 2026-11-16: Current major version
    api.github.com/repos/apostrophecms/apostrophe/tags
  8. 2026-11-16: Contributors
    api.github.com/repos/apostrophecms/apostrophe/contributors?per_page=1
  9. 2026-11-16: npm downloads a week
    api.npmjs.org/downloads/range/2026-11-01:2026-11-07/sanitize-html
  10. 2026-11-16: Dependent packages, Dependent repositories
    packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/sanitize-html

Last reviewed · Listed since Edit on GitHubThis page as markdownas JSON