NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #47 most downloaded on npm
Encode & decode XML and HTML entities with ease & speed
Last release 26 days ago
07 Sep 2026
Release timing varies
gaps range from 8 days to 1.2 years
Most releases are documented
notes for 22 of 36 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
36 releases · first in 2012
Faster decoding & escaping, with smaller bundles. Encoding output stays compatible with v8.
Faster decoding & escaping, with smaller bundles. Encoding output stays compatible with v8.
decodeHTML 1.19×, decodeHTMLStrict 1.14×, decodeHTMLAttribute 1.18×, decodeXML 1.46×, default decode 1.44× as fast. #2248, #2348escapeUTF8 1.49×, escapeAttribute 1.23×, escapeText 1.33× as fast. #2247, #2348encodeHTML 1.70×, encodeNonAsciiHTML 2.24×, encodeXML / escape 2.46× as fast. On the short, dense benchmark input, HTML encoding is unchanged; XML encoding and default encode take about 6% longer. #2246, #2348Compared with v8.0.0; speedups are medians of nine runs on Node 26.8.1, Linux/x64. Short inputs use the repository benchmark fixtures; results vary with input.
decodeHTMLAttribute preserves interrupted references such as ¬in<, previously incorrectly decoded to ¬in<. #2213decodeHTML preserves unterminated names such as &Xi$, previously incorrectly decoded to Â. #2331decodeXML and default decode preserve XML numeric code points: € now yields U+0080 instead of €. HTML decoding still yields €. By @adarshx01 in #2347.String.prototype.codePointAt instead of getCodePoint from entities/escape. #2268Full Changelog: v8.0.0...v8.1.0
One column per quarter.
BREAKING CHANGE: entities is now ESM-only #2183
Full Changelog: v7.0.1...v8.0.0
Addresses an issue that broke streaming for htmlparser2 by @fb55 in #2117
Full Changelog: v7.0.0...v7.0.1
No changes in public API; a lot of internals changed though, for faster encoding & decoding and reduced memory usage.
No changes in public API; a lot of internals changed though, for faster encoding & decoding and reduced memory usage.
Reduced length of the encoded trie by 21% for HTML (from 15,242 words (uint16) to 12075), by:
Also reduces the size of the encoded table by 32% (after the previous change) by encoding it as base64.
Encodes the encode trie as a string, with a simple parser turning it into the previous structure on load. This leads to a 44% decrease in file size (from 24,034 to 13,392 bytes).
Uses bitmaps to replace regex when looking for ASCII code points that should be replaced with entities. Leads to a ~1.6x speed up for encodeHTML.
Full Changelog: v6.0.1...v7.0.0
fix: add types for old node entry points by @43081j in #1861
Full Changelog: v6.0.0...v6.0.1
Improved bundler tree shaking by adding pure annotations by @Gravitonic in #1501
entities/dist/decode.js, import entities/decode. The same applies to escape.entities is now available on both npm and JSRFull Changelog: v5.0.0...v6.0.0
Improved code style (based on eslint-plugin-unicorn ) #1496
eslint-plugin-unicorn) #1496lib directory was renamed to dist in #1497. Deep imports will have to be updated.Full Changelog: v4.5.0...v5.0.0
entities now features an EntityDecoder class that can be used to decode entities across multiple chunks. This is needed to parse streams, and will be
entities now features an EntityDecoder class that can be used to decode entities across multiple chunks. This is needed to parse streams, and will be the foundation for entity decoding in htmlparser2 and parse5.
For users of this library, the most welcome addition will be a new attribute decoding mode, which will ignore some entities that were previously parsed (eg. `foo=bar&=boo' will be left unchanged).
entities' decode functions all use the new decoder under the hood. There is a new decodeHTMLAttribute function for attribute parsing, and some rare edge-cases where entities diverged from the HTML spec have been eliminated.
EntityDecoder class by @fb55 in #1136Full Changelog: v4.4.0...v4.5.0
Smaller encode/decode maps by @sapphi-red in #909
Please note that some JavaScript minifiers, such as terser, will now produce non-ASCII output. If you use entities in the browser, please make sure you are set up to ship UTF-8 to clients, or set eg. terser's ascii_only option to false.
Full Changelog: v4.3.1...v4.4.0
Fixed an off-by-one error that caused some entities to be decoded to different values ( #858 ) 3b0d48b
Added an escape file, which is available as an export #786
escape file, which is available as an export #786sourceRoot property in source maps #788
Full Changelog: v4.2.0...v4.3.0
Handle edge-case with surrogate pairs in encode 413c48b
Fixes:
encode 413c48bFeatures:
replaceCodePoint from entities/lib/decode 2247ebeOther:
strict-boolean-expressions (#779) ce2b30bisHighSurrogate check 03a8f4aits/* instead of Node 10 1a69212.eslintrc.json bf89c65https://github.com/fb55/entities/compare/v4.1.1...v4.2.0
fix: Missed ESM change by @Jiralite (#778) b4a04cb
https://github.com/fb55/entities/compare/v4.1.0...v4.1.1
We now pre-generate the encode trie (#776) 3ef75e1
https://github.com/fb55/entities/compare/v4.0.0...v4.1.0
entities is now both an ESM and a CommonJS module
New Features:
entities is now both an ESM and a CommonJS module (#775)entities now has a new documentation website! (Added in 720a36d.)escapeAttribute and escapeText functions, implementing the escaping required by the HTML serializer algorithm (#770)Breaking:
Docs:
Refactors:
Fixes an issue where some characters above the high surrogate plane would be considered as surrogate characters as well (#562) 769ce35
https://github.com/fb55/entities/compare/v3.0.0...v3.0.1
entities@3.0.0 features more configurable encode and decode functions and rewritten decode & encode functions, resulting in a huge speedup.
entities@3.0.0 features more configurable encode and decode functions and rewritten decode & encode functions, resulting in a huge speedup.
encode, decode functions 817ae67You can now pass an object with additional configuration options to the exported encode and decode function. You can still use the relevant function directly, but this will make it easier to figure out what you want to do in the first place!
entities is now using tries for encoding and decoding entities. Especially when decoding, this leads to considerable performance improvements. The simple benchmark in scripts/benchmark.ts is useful for comparing the performance of these two versions:
| Version | decode perf |
encode perf |
escape perf |
|---|---|---|---|
| 3.0.0 | 1.418s | 6.786s | 2.196s |
| 2.2.0 | 4.085s | 14.842s | 5.166s |
| Speedup | 2.9x | 2.1x | 2.4x |
entities was the fastest library in the space for a while. The friendly competition was a great reason to come up with smarter algorithms to push the envelope just a bit further. Now entities is on top again, but we'll see how long that lasts!Add doc comments for most methods, deprecate some methods 8b1bc21
encodeNonAsciiHTML function 03b9143
encodeHTML, but skips characters that are perfectly valid in ASCII and HTML.escapeUTF8 function 1ea2418
https://github.com/fb55/entities/compare/v2.1.0...v2.2.0
Minified built-in JSON maps (#305 by @fabiospampinato) 97ebff3
https://github.com/fb55/entities/compare/v2.0.3...v2.1.0
Convert RegEx to ES5, restoring backwards compatibility (#212, by @manish-kothari)
Nothing published for this version
- Port tests to Jest - Modernize codebase
The public-facing API should be identical
The public-facing API should be identical
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →