HTML Entities Encoder & Decoder
Encode and decode HTML entities online: named, decimal and hex, XML-safe mode, all non-ASCII characters, emoji. Invalid codes are reported. Runs in your browser.
How to use HTML Entities
- 1Choose Encode or Decode, then paste your text or open a file.
- 2For Encode, pick XML-safe or HTML named entities, decimal or hex, and whether to encode all non-ASCII characters.
- 3Copy or download the result; any unknown names or invalid codes are listed under it.
What makes it better
- Encode and Decode on one page; switching mode keeps your text
- XML-safe mode escapes only & < > " ', HTML mode also uses names like é, — and €
- Optional encoding of every non-ASCII character as é (decimal) or é (hex), with emoji as one code point
- Decodes named, decimal and hex references, one level only, and tells you what it left alone
- Invalid numeric references (0, surrogates, beyond U+10FFFF) are reported with their position
About HTML Entities
This page converts text to HTML entities and back. Encoding can escape only the five markup characters (& < > " '), use a bundled table of about 250 named entities such as © and €, and optionally write every other non-ASCII character, emoji included, as a decimal or hex reference. Decoding handles named, decimal and hex references, lists any it does not recognise and reports invalid code points instead of dropping them.
Common uses
- Escape a code sample or user comment so it shows as text inside an HTML page instead of being parsed.
- Read an email template, RSS feed or scraped page full of &, and ’ entities.
- Make an XML or SVG snippet safe to embed in an attribute or a text node.
- Convert accented and symbol characters to ASCII-only entities for a system that mangles UTF-8.
Example
Input
<p class="note">Café “menu”: 5 € — save 20% & enjoy 😀</p>
Result
<p class="note">Café “menu”: 5 € — save 20% & enjoy 😀</p>
Good to know
- Named decoding uses a bundled table of the HTML 4 names plus ' (about 250 in all), not the full HTML5 list of more than 2,000. Names outside the table are left as written and listed, so nothing is changed silently.
- A reference must end with a semicolon to be decoded: © is left alone, © becomes ©. Browsers accept a few legacy names without it, this tool does not.
- Decoding is a single pass, so &lt; becomes < and not <. Entity-encoding is not a security control on its own; escape for the context where the text is used.
HTML Entities FAQ
How do I encode HTML entities?
Paste your text with Encode selected. The characters & < > " and ' are always escaped, and in HTML named mode accented letters and symbols such as é, © and € also become their names. Copy the result into your HTML source.
How do I decode HTML entities like & and ’?
Switch to Decode and paste the text. Named entities (&, ), decimal ones (’) and hex ones (’) are replaced with the characters they stand for, and a status line counts how many of each were converted.
What is the difference between XML-safe and HTML named entities?
XML-safe escapes only the five characters XML reserves and uses ' for the apostrophe, which XML defines. HTML named mode also replaces characters that have an HTML name, and writes the apostrophe as ' because older HTML versions do not define '.
How are emoji and characters outside the BMP encoded?
With Encode all non-ASCII characters on, an emoji such as 😀 becomes a single reference, 😀 or 😀, built from its full code point rather than from two surrogate halves, so browsers show it correctly.
What happens to an entity the tool does not know?
It is left exactly as typed and listed in a notice under the result, for example &foo;. An invalid numeric reference such as � or � is also kept and reported with its line and column, never silently removed.