How HTML entity encoding works
A web browser parses some characters as markup. A less-than sign starts a tag, an ampersand starts an entity, and quotes delimit attribute values. If you want those characters to appear as literal text — say, to show example code — you must escape them by replacing each one with its HTML entity.
The five reserved characters and their safe forms are: & → &, < → <, > → >, " → ", and ' → '. The ampersand is always escaped first, otherwise the ampersands inside the other entities would themselves be re-encoded into &lt; and the output would be wrong.
<a href="x">Tom & Jerry</a> encodes to <a href="x">Tom & Jerry</a>. Pasted into a page, that displays the tag literally instead of rendering a link. Decoding the same string reverses every step and returns the original line.Decoding does the opposite: it scans for entities and replaces them. Named entities like © map to a fixed character (©), while numeric entities reference a code point in decimal (©) or hexadecimal (©). This tool decodes a common set of named entities plus all numeric references, without injecting your input as live HTML.
Common characters and their entities
| Character | Name | Named entity | Numeric (dec) | Numeric (hex) |
|---|---|---|---|---|
| & | Ampersand | & | & | & |
| < | Less-than | < | < | < |
| > | Greater-than | > | > | > |
| " | Double quote | " | " | " |
| ' | Apostrophe | ' | ' | ' |
| Non-breaking space | |   |   | |
| © | Copyright | © | © | © |
| ® | Registered | ® | ® | ® |
| € | Euro | € | € | € |
| £ | Pound | £ | £ | £ |
| — | Em dash | — | — | — |
| … | Ellipsis | … | … | … |
Reference note: encoding always escapes the five reserved characters. With "encode all non-ASCII" enabled, every character above code point 127 is emitted as a decimal numeric entity, which is the most portable form for older systems and email.
Frequently asked questions
- What are HTML entities?
- HTML entities are short codes that represent characters which would otherwise be reserved or hard to type in HTML. They start with an ampersand and end with a semicolon, like
<for the less-than sign, and let you show a character as text instead of having the browser treat it as markup. - How do I escape HTML special characters?
- Replace each reserved character with its entity:
&→&,<→<,>→>,"→",'→'. Escape the ampersand first so the others are not double-encoded. The encoder above does this for you. - What is & / < / >?
&is the entity for an ampersand (&),<is the less-than sign (<), and>is the greater-than sign (>). These three, plus"and', cover the characters that break HTML if left raw.- When do I need to encode HTML?
- Encode when you want to display code or symbols literally — for example showing an example
<div>tag in a tutorial — and whenever you insert untrusted text into a page, so reserved characters cannot break the markup or open a security hole. - How do I decode HTML entities?
- Switch the tool to Decode mode and paste text containing entities. It converts named entities such as
&and numeric references such as©or©back into their original characters. - What's the difference between named and numeric entities?
- Named entities use a memorable label, like
©for ©. Numeric entities use the character's code point in decimal (©) or hexadecimal (©). Numeric entities work for any character; named entities only exist for a defined set.