# sanitize-html

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


Source: https://findsoftware.frbit.cloud/sanitize-html/
Last reviewed: 2026-11-16
Listed since: 2026-11-16

## Record

### Links

- repository: https://github.com/apostrophecms/apostrophe
- docs: https://github.com/apostrophecms/apostrophe/tree/main/packages/sanitize-html#readme

### Identity

- status: active
- maintainer: P'unk Avenue LLC
- maintainerType: company
- parent: unknown
- firstRelease: 2013
- hqCountry: unknown

### Kind

- category: library
- hosting: node
- language: javascript
- runtime: node
- runtimeMin: node 22
- basedOn: unknown

### Content

- contentStore: not applicable
- databases: not applicable
- adminUi: not applicable
- headlessApi: not applicable
- templating: not applicable
- i18n: not applicable

### Rendering and deploy

- runsAs: not applicable
- renderingModes: not applicable
- installMethod: npm

### License

- licenseModel: open-source
- license: MIT

### Releases

- currentMajor: 2
- latestReleaseDate: 2026-11-11

### Adoption

- githubStargazers: 4669
- packagistDownloads: not applicable
- npmWeeklyDownloads: 18174490
- contributors: 101
- pluginCount: unknown
- packagistMonthlyDownloads: unknown
- ecosystemsMonthlyDownloads: unknown
- httpArchiveSites: unknown
- wordpressActiveInstalls: unknown
- dependentRepos: 89985
- dependentPackages: 1495

### Sources

- urls: https://api.github.com/repos/apostrophecms/apostrophe (read 2026-11-16)
- urls: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/README.md (read 2026-11-16)
- maintainer: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/LICENSE (read 2026-11-16)
- language: https://api.github.com/repos/apostrophecms/apostrophe (read 2026-11-16)
- category: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/README.md (read 2026-11-16)
- runtime: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/README.md (read 2026-11-16)
- runtimeMin: https://registry.npmjs.org/sanitize-html/latest (read 2026-11-16)
- installMethod: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/README.md (read 2026-11-16)
- license: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/package.json (read 2026-11-16)
- licenseModel: https://raw.githubusercontent.com/apostrophecms/apostrophe/main/packages/sanitize-html/package.json (read 2026-11-16)
- firstRelease: https://registry.npmjs.org/sanitize-html (read 2026-11-16)
- currentMajor: https://api.github.com/repos/apostrophecms/apostrophe/tags (read 2026-11-16)
- latestReleaseDate: https://registry.npmjs.org/sanitize-html (read 2026-11-16)
- githubStargazers: https://api.github.com/repos/apostrophecms/apostrophe (read 2026-11-16)
- contributors: https://api.github.com/repos/apostrophecms/apostrophe/contributors?per_page=1 (read 2026-11-16)
- npmWeeklyDownloads: https://api.npmjs.org/downloads/range/2026-11-01:2026-11-07/sanitize-html (read 2026-11-16)
- dependentPackages: https://packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/sanitize-html (read 2026-11-16)
- dependentRepos: https://packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/sanitize-html (read 2026-11-16)

## Notes

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.

---

Data licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Attributes are recorded, never scored; absent means unknown.
Credit, in full: FindSoftware, CC BY 4.0
