UltKit

HTML Entity Encoder & Decoder

Escape the characters that HTML treats as markup, optionally every non-ASCII character too, or turn entities such as é and — back into plain text. Both directions run in your browser, and decoded input is never rendered as live HTML.

Mode
Entity style
Escape

0 characters · 0 words · 0 lines

0 characters · 0 words · 0 lines

Runs entirely in this browser tab. Your text is never uploaded or stored.

Common characters and their entities

Named, decimal and hexadecimal forms all decode to the same character. The encoder knows 216 common named entities; the decoder understands every named reference in the HTML standard.

CharacterNamedDecimalHex
&&&&
<&lt;&#60;&#x3C;
>&gt;&#62;&#x3E;
"&quot;&#34;&#x22;
'&apos;&#39;&#x27;
(no-break space)&nbsp;&#160;&#xA0;
©&copy;&#169;&#xA9;
®&reg;&#174;&#xAE;
™&trade;&#8482;&#x2122;
€&euro;&#8364;&#x20AC;
£&pound;&#163;&#xA3;
¥&yen;&#165;&#xA5;
—&mdash;&#8212;&#x2014;
–&ndash;&#8211;&#x2013;
…&hellip;&#8230;&#x2026;
«&laquo;&#171;&#xAB;
»&raquo;&#187;&#xBB;
°&deg;&#176;&#xB0;
×&times;&#215;&#xD7;
÷&divide;&#247;&#xF7;
é&eacute;&#233;&#xE9;
π&pi;&#960;&#x3C0;
→&rarr;&#8594;&#x2192;
😀—&#128512;&#x1F600;

From 252 entities in HTML 4 to 2,231 in HTML5

A character reference is a way to write a character with ASCII only. Numeric references work for any Unicode code point, in decimal (&#233;) or hexadecimal (&#xE9;). Named references are easier to remember: HTML 4 defined 252 of them, covering Latin-1 letters such as &eacute;, Greek letters, mathematical symbols and typographic marks like &mdash; and &hellip;. Curiously &apos; was not among them; it came from XML and only became valid HTML with HTML5.

HTML5 expanded the list to 2,231 named character references, absorbing the MathML entity set, so names like &check;, &bigstar; and &NotEqualTilde; now work in every current browser. The count includes legacy spellings without the closing semicolon, such as &amp and &copy, which parsers still accept for compatibility but which you should not write. The encoder here produces the widely supported HTML 4 names plus &apos; and falls back to a numeric reference for everything else; the decoder hands text to the browser's own parser, so it understands every one of the 2,231 names.

What to escape, and where escaping is not enough

Only & < > " ' is the setting for everyday work: it escapes the five characters that can end a text node or a quoted attribute, which is enough to show a code sample on a page or place user text safely inside HTML. Also every non-ASCII character turns é, € and emoji into references too, for the rare channel that cannot carry UTF-8, such as some legacy email templates or systems that mangle encodings. Named, Decimal and Hex only change how a reference is spelled; all three decode to the same character. A page saved as UTF-8 needs no entities for accented letters.

Escaping protects the HTML context and nothing else. Text inserted into a script block, an inline event handler such as onclick, a style attribute or an href that might start with javascript: needs different handling, and entity encoding alone does not prevent cross-site scripting there. Frameworks such as React escape text by default, so double-escaping is the more common bug in modern apps: users see &amp; where an ampersand should be. To strip tags entirely, convert the markup with HTML to TXT; for escaping inside URLs, use URL Encode & Decode.

Frequently asked questions

Which characters must be escaped in HTML?
In text, & and < are the essential ones, and > is escaped by convention. Inside an attribute value, also escape the quote character that delimits it. Escaping all five covers both cases.
What is the difference between &nbsp; and a normal space?
&nbsp; is the no-break space, U+00A0. It looks like a space but prevents a line break at that point and is not collapsed when several appear together, unlike ordinary spaces in HTML.
Why does my page show &amp; instead of an ampersand?
The text was escaped twice: once in your data and again by your template or framework. Store raw text and let one layer, usually the template, do the escaping at output time.
Is it safe to decode HTML from an untrusted source here?
Yes. The decoder parses input as plain text content, so tags are not created, scripts do not run and images do not load. Only entity references are turned into characters.
Are named or numeric entities better?
Named ones are easier to read, numeric ones work for every character and in every XML parser. In XML without a DTD, only &amp;, &lt;, &gt;, &quot; and &apos; are predefined.