PAGES
← all tools
◆ Web Application Security

DOMPurify

3.4.15 open-source

DOMPurify - a DOM-only, super-fast, uber-tolerant XSSXSSCross-site scripting, an attack that runs malicious script in another user's browser through a trusted site. It can steal data or perform actions using the user's session. sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

Summary

DOMPurify is an open-source (MPL-2.0 or Apache-2.0) JavaScript library that sanitizes HTML, MathML and SVG to strip out cross-site-scripting payloads before they reach the DOM. It's imported directly into application code rather than run as a service, and it works across all modern browser engines (Blink, Gecko, WebKit), degrading harmlessly on legacy ones like older MSIE. It's aimed at application developers who need to render untrusted or user-supplied markup safely, and its allow-lists for tags, attributes and URI schemes can be tuned or extended with functions as a project's components grow. It sits in the web-app-security space alongside other DOM sanitization approaches, with configuration hardening added specifically against prototype-pollution attacks on the sanitizer itself. First committed in 2014, it remains active with 143 contributors, 324 commits and 22 releases in the past year, the latest just 18 days ago.

DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

How DOMPurify helps

Is this chunk of user-supplied markup safe to drop into the page?

runs it through the allow-lists for tags, attributes and URI schemes and returns a cleaned string or DOM node with anything dangerous stripped out, so what comes back can be inserted directly

Can a crafted attribute or tag sneak a script past this sanitizer?

matches every tag, attribute and scheme against its allow-list rather than trying to pattern-match known exploits, so unrecognized constructs are dropped by default instead of passed through

Does my custom UI markup still get through after sanitizing?

lets tags, attributes and custom elements be allowed dynamically through functions, so a growing component library can be permitted by name or pattern instead of hand-listing every case

Could someone attack the sanitizer's own configuration rather than the page?

hardens its configuration handling against prototype-pollution attempts, so tampering with the config object itself doesn't change what gets sanitized

Will this markup still be safe once it's mutated by the browser after insertion?

includes scrubbing behavior aimed at mutation-based XSS, where content that looks clean becomes dangerous only after the DOM parses and mutates it

Is a link using an unusual URI scheme actually safe to render?

checks the scheme against its allow-list of accepted protocols and strips the link if the scheme isn't recognized

all 4 features, with the evidence for each →

Languages

Not documented

Features

4 capabilities

Built from DOMPurify's releases, docs, README and our own runs. “Seen” marks the month we first spotted a release the vendor didn't date.

Compare with peers →

All capabilities 4 capabilities
HTML and SVG sanitization shipped Sanitizes HTML and SVG markup, filtering unsafe patterns including incremental DOM mutations while preserving valid SVG attributes. 48 releases · 16 other sources · first seen Apr 2014

release 48 total

  • Adds several smaller hardening improvements and edge-case fixes to the sanitization engine. 3.4.15 · Sep 2026 · source · release history
  • Adds stronger DOM-clobbering hardening specifically for XML content parsing paths. 3.4.15 · Sep 2026 · source · release history
  • Adds the pointer-events presentation attribute to the allow-list for SVG elements 3.4.14 · Aug 2026 · source · release history
  • Adds SVG pointer-events and vector-effect presentation attributes to the built-in allow-list, enabling their use in sanitized SVG content without custom configuration. 3.4.14 · Aug 2026 · source · release history
  • Strengthens handling of declarative partial updates to reduce exposure from incremental DOM mutation patterns. 3.4.12 · Jul 2026 · source · release history
  • Supports additional SVG attributes, expanding the set of valid SVG markup that passes through sanitization. 3.4.12 · Jul 2026 · source · release history

docs

  • DOM-only XSS sanitizer for HTML, MathML, and SVG that strips dangerous markup and returns clean strings or DOM nodes.

example 15 total

  • Conditionally permit custom elements by name using a function so your allow-list stays maintainable as your component library grows. DOMPurify.sanitize(dirty, { ADD_TAGS: (tag) => tag.startsWith('myapp-') }); 3.3.0 · Oct 2025 · source
  • Dynamically allow only data attributes whose names match a project-specific pattern, instead of enumerating every permitted attribute upfront. DOMPurify.sanitize(dirty, { ADD_ATTR: (attr) => attr.startsWith('data-myapp-') }); 3.3.0 · Oct 2025 · source
  • Use the new tagName parameter in attributeNameCheck to allow an attribute only on specific elements, tightening custom sanitization rules. DOMPurify.sanitize(dirty, { CUSTOM_ELEMENT_HANDLING: { attributeNameCheck: (attrName, tagName) => { // Only allow 'data-tooltip' on <my-button>, block it everywhere else if (attrName ===… 3.2.7 · Sep 2025 · source
  • Remove a single named hook without tearing down all other registered hooks. // Previously you could only removeAllHooks(); now remove just one: DOMPurify.removeHook('beforeSanitizeElements'); 3.2.4 · Jan 2025 · source
  • Allow sms: links in sanitized content to enable deep linking to SMS apps. const clean = DOMPurify.sanitize('<a href="sms:5551234">Text us</a>'); 3.0.2 · Apr 2023 · source
  • Sanitize HTML containing MathML with <mprescripts> tags without removing them. const clean = DOMPurify.sanitize('<math><menclose mprescripts>...</menclose></math>'); 3.0.2 · Apr 2023 · source
Distribution package shipped Provides a tested, compressed build artifact in the distribution directory for direct project integration. 2 releases · 1 other source · first seen Sep 2015

release

example

  • Verify the new license metadata in the built artifact before bundling. grep -i 'license' dist/purify.min.js 2.0.9 · Apr 2020 · source
Prototype poisoning protection shipped Detects and blocks attempts to maliciously modify JavaScript object prototypes during input processing. 1 release · first seen Feb 2020

release

MathML sanitization shipped Adds support for sanitizing MathML markup to ensure safe formula rendering. 1 release · first seen Apr 2014

release

  • Extended MathML support for enhanced formula rendering safety 0.3 · Apr 2014 · source · release history

Lines in monospace are the tool's own words: help text parsed from its source, or an endpoint from its API document. Under release, a line is our summary of a dated release. Under docs, it is quoted from the tool's own documentation or website. Each links back to the source it came from.

Score card

  1. Shipping velocity releases a month, last 12 months
  2. Documentation quality release-notes rubric, 0–100
  3. Breaking-change discipline how rarely a release breaks users, and notice given
  4. Maintenance risk quiet time against its own cadence, maintainers
  5. Innovation & surface new capabilities, API and MCP surface
  6. Community health
  7. Contributor trend distinct committers, this year against last
  8. Maintainer concentration bus factor now against a year ago
  9. Issue backlog trend issues closed per issue opened, 12 months
  10. Responsiveness median time to a maintainer’s first reply

Nine scores for DOMPurify, each built from the releases, notes and API history this site tracks — and, on Researcher and Business, where it stands among every measured tool in its category and how that has moved.

Score cards are part of every paid plan.

See plans →

Each score is 0–100 on a published rubric, derived from data this site already shows. A dimension we cannot measure says so — it is never scored 0 and never enters a rank.

How this is scored
  • Shipping velocity — releases a month over the last 12 months, on a log scale where 16 a month scores 100. Needs 3 releases in the window.
  • Documentation quality — the release-notes rubric published on the analytics page, unchanged.
  • Breaking-change discipline — the share of releases carrying a breaking change (none scores 100, half or more scores 0). Only projects that label breaking changes are measured: a clean record cannot be told from an unlabelled one.
  • Maintenance risk — quiet time measured against the tool's own release cadence (quiet longer than 90 days and three typical gaps scores 0), plus the number of active maintainers and whether contributors are growing, where known. Higher is lower risk.
  • Innovation & surface — new capabilities in the feature ledger this year, API and MCP operations added, and the share of commits that are features: the mean of whichever we hold.
  • Community health (open-source tools only) — each is a direction, not a size: contributors this year against last, the bus factor now against a year ago, and issues closed per issue opened, where steady scores 50, doubled 100 and halved 0; plus the median time to a maintainer's first reply (an hour scores about 100, a month or more 0). A commercial card has no repository and carries none of the four.
  • Documented delivery (commercial tools) — when a vendor's documented new capabilities have slowed against its own baseline, that counts against the overall standing as heavily as two low dimensions. Steady delivery, or too little history to judge, leaves the standing alone; it is never a sixth score.
  • Open-source tools are scored on repository signals; commercial tools on their published changelog. Ranks compare tools within one category and one profile and need at least five measured peers; the overall standing needs three ranked dimensions. Best-in-breed or consolidator is a shape, not a quality, and is never scored.

Release-note detail over time

See how much detail DOMPurify puts in its release notes, quarter by quarter, and compare it with tracked tools in the same category. This history uses up to ten retained, reviewed notes per tool; sparse or blank older quarters may reflect that limit.

Checking release-note history…

Explore the full chart →

Releases

Show

32 entries

  1. September 20261
  2. August 20261
  3. July 20261
  4. May 20264
  5. April 20263
  6. October 20251
  7. September 20251
  8. May 20251
  9. January 20251
  10. October 20242
  11. September 20241
  12. April 20241
  13. April 20231
  14. February 20231
  15. November 20221
  16. August 20221
  17. December 20211
  18. April 20201
  19. February 20201
  20. September 20191
  21. April 20171
  22. May 20161
  23. October 20151
  24. September 20151
  25. February 20151
  26. April 20141
    Show

    32 entries

    Project health

    Issue, contributor and maintainer activity in cure53/DOMPurify, 2023-10 – 2026-09, as of 2026-09-25. Twelve-month figures first; the trend lines run the whole window.

    1. Contributors 16 −5 vs prior 12 months
    2. Maintainers 1 +2 joined · −4 left, last 12 months
    3. Bus factor 1 committers behind half the commits
    4. Community-filed 100% of issues opened, last 12 months
    5. Median time to close < 1 day first maintainer reply 12 hours
    6. Open backlog 0 of 714 issues ever filed
    1. Issues opened / month 1 · 0 communitymaintainers
    2. Open backlog 0
    3. Contributors / month 2
    4. Commits / month 10
    5. Stars 17,406
    Issue themes, last 12 months
    • other 100%

    Counts from the project's public repository and git history; no individuals are identified. Maintainers are the committers covering 80% of the last year's commits. how we measure this

    Add the badge to your README

    Maintain this project? The badge links readers straight to this page, so they can follow every release here.

    Tracked by Cyber Toolchain Choose a badge style and copy the code →
    browse all tools → score card for your toolchain →