# HtmlSanitizeEx

> HTML sanitizer for Elixir that strips or allow-lists tags to stop XSS

Source: https://talira.ai/catalog/htmlsanitizeex-nznx4k2z
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [security / html sanitization](https://talira.ai/categories/security/html-sanitization), [languages / elixir](https://talira.ai/categories/languages/elixir)
- Licence: MIT[^2]
- Pricing: Free and open source[^2]
- Pricing notes: Free and open source (MIT).
- Free tier: yes[^2]
- Backed by: [René Föhring](https://talira.ai/orgs/rene-fohring.md)

HtmlSanitizeEx (the html_sanitize_ex package) is an HTML sanitizer written in Elixir that lets a web app include HTML written by third parties while protecting against cross-site scripting. It parses an HTML string and, depending on the scrubber, strips every tag or keeps only allowed elements and attributes. Built-in scrubbers cover plain text, basic HTML, HTML5 and Markdown-generated HTML, and you can define your own scrubber that allows only the tags, attributes and URI schemes you need. Its only dependency is mochiweb, which it uses to parse HTML.

## Links

- GitHub: https://github.com/rrrene/html_sanitize_ex
- Docs: https://hexdocs.pm/html_sanitize_ex/

## Problems it solves

- let users post HTML in my Phoenix app without opening an XSS hole
- strip all HTML tags from a string in Elixir
- allow only links and paragraphs in user comments in Elixir

## Features

- strip_tags, basic_html, html5 and markdown_html scrubbers
- custom scrubbers that allow only chosen tags, attributes and URI schemes
- removes CDATA sections and comments in custom scrubbers
- one dependency: mochiweb

## Limitations

- Its README says to check that a built-in scrubber does what you expect before you use or extend it.[^1]

## Trust

Overall: 0.39 out of 1.
Signals: maintenance 0.49, adoption 0.49, momentum 0.15, community 0.58, backing 0.30, extensibility 0.00.

- last commit 43 days ago
- 6 commits in the last 90 days
- latest release v1.5.6 43 days ago
- 296 GitHub stars
- 28 contributors
- backed by René Föhring

## Sources

[^1]: https://github.com/rrrene/html_sanitize_ex/blob/master/README.md (checked 29 Nov 2026)
[^2]: https://github.com/rrrene/html_sanitize_ex/blob/master/LICENSE (checked 29 Nov 2026)
