Skip to content

@technobuddha > library > Programming > Escaping

Function: unescapeHTML()

ts
function unescapeHTML(input: string): string;

Defined in: unescape-html.ts:23

Unescape a string encoded in HTML

Escape SequenceCharacter
&#n…;Numeric character
&#xn…;Hexadecimal character
&xc…;Named entity

Parameters

ParameterTypeDescription
inputstringThe string to unescape

Returns

string

the string with escapes resolved

Example

typescript
unescapeHTML('Hello & World'); // "Hello & World"
unescapeHTML('2 &lt; 3 &gt; 1'); // "2 < 3 > 1"
unescapeHTML('&#169; 2025'); // "© 2025"
unescapeHTML('&#x1F600;'); // "😀"