The inverse of _.escape — replaces &, <, >, ", ', and ` with their unescaped counterparts (official Underscore docs). Stable since 1.4.0 — not deprecated.
Pass the required arguments shown below. Underscore utility helpers usually return a new value or function — check edge cases before you ship.
Syntax
Call _.unescape. Start with this line.
Underscore
_.unescape(string)
Call
What it does
_.unescape(string)
Primary signature.
_.unescape(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.unescape(string)
Parameters
Parameter
Description
string
Required. Text that may contain escape entities
Return Value
Return Value
Description
*
New string with the six entities restored
Underscore.js Examples
Example 1 — Official Docs Example
Restore the ampersand in the Stooges names string.
Underscore
_.unescape("Curly, Larry & Moe");
// → "Curly, Larry & Moe"
unescape(escape(s)) restores the original for the six sensitive characters.
Underscore
var original = "Curly, Larry & Moe";
var encoded = _.escape(original);
_.unescape(encoded);
// → "Curly, Larry & Moe"
_.unescape(encoded) === original;
// → true
Second call. Needed only if the string was escaped twice.
Nullish. Missing values coerce to "".
Safe default. You do not get "null" as text.
Compatibility
Browser & Runtime Support
_.unescape ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.x
_.unescape()
Available in [email protected] (UMD / ESM). Added in 1.4.0 as the inverse of _.escape. Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.unescapeUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.unescape(string) is the opposite of _.escape. It replaces the HTML entities &, <, >, ", ', and ` with &, <, >, ", ', and `.
_.unescape('Curly, Larry & Moe') returns 'Curly, Larry & Moe'. That is the reverse of the official _.escape example.
Yes for the six HTML-sensitive characters Underscore encodes. It is not a full HTML5 decoder, so text that used other entities will not round-trip.
No. Unescape restores < and & so the browser can treat the string as markup. Prefer textContent, or escape on output. Unescape is for recovering original text, not for rendering HTML.
No. It is a stable Underscore utility added in version 1.4.0 so you can reverse _.escape without a second library.