What HTML entities are
An HTML entity, or character reference in the words of the HTML Standard, writes a character as plain ASCII text that starts with an ampersand. There are three kinds, and browsers decode all of them to the same character:
- Named references like © for ©. The name must match exactly, including upper and lower case, so É is É and é is é.
- Decimal numeric references like ©, the code point of the character in base ten.
- Hexadecimal numeric references like ©, the same number in base sixteen, with an x or X after the #.
The names come from the named character references table of the HTML Standard. It holds 2,231 entries: 2,125 names with a semicolon, plus 106 of them that are also accepted without one for compatibility with old pages. This HTML entity converter uses that list, read from the official entities.json file. Numeric references work for every character, also the many that have no name.
Which special characters you have to escape
The HTML syntax rules are narrower than many people think. In normal text the standard forbids two things: a literal <, and an ambiguous ampersand, which is an & followed by letters or digits and a semicolon that do not form a known name. In an attribute value written in double quotes, a literal " is not allowed, and in single quotes no literal '. A > never has to be escaped.
| Character | Named | Decimal | Hex | Must be escaped |
|---|---|---|---|---|
| & | & | & | & | When letters, digits or # follow it |
| < | < | < | < | In text |
| > | > | > | > | Never, but escaping it is harmless |
| " | " | " | " | In attribute values in double quotes |
| ' | ' | ' | ' | In attribute values in single quotes |
Escaping all five special characters, & < > " ', is still the simple rule that is safe everywhere, whether the text lands between tags or in an attribute. That is what the default setting does, and you never have to think about which quotes an attribute uses or whether an ampersand happens to be followed by a word. It is also the escaping to use when you show code samples on a web page, so the browser displays <div> instead of creating an element. Note that escaping protects text in HTML only; inside a script element or a URL other rules apply.
The option Also all non-ASCII writes every character above U+007F as a reference too, so the result is pure ASCII. You seldom need that today: the HTML Standard requires documents to be encoded in UTF-8, which holds every character directly. It helps when the text has to pass through a system that only handles ASCII.
How browsers decode entities, and how this tool does
The decoder follows the character reference states of the HTML tokenizer step by step, so the result matches what a browser shows, including the odd cases:
- Longest match. The parser takes the longest name it can find. That is why ¬it; becomes ¬it; while ∉ becomes ∉, the example the standard itself gives.
- No semicolon. The 106 legacy names also work without the semicolon, so © 2026 shows © 2026. Other names, and every name inside an attribute value that is followed by = or a letter or digit, stay as they are. Switch on Read as an attribute value to get that behavior for an href or a title.
- Numbers 128 to 159. These are control codes in Unicode, but the parser maps 27 of them to the characters they have in the Windows-1252 character set, so € becomes € and ™ becomes ™.
- Impossible numbers. �, numbers above 10FFFF in hex and surrogate code points become the replacement character �.
Every case that the standard calls a parse error, such as a missing semicolon or an unknown name like &foo;, is listed in a note with its position, so you can clean up your markup. If the decoded text still contains references, for example after &lt;, the tool spots the double encoding and offers to decode once more.
The decoder was checked against the browser's own HTML parser and against the open source entities package for Node.js, on tens of thousands of generated strings, with no difference. For other kinds of escaping, the URL encoder and decoder handles percent encoding and the Base64 encoder turns text or files into Base64.
How to use the HTML entity converter
- 1Choose Encode to escape text for HTML, or Decode to unescape entities back into plain text.
- 2Paste your text. The result updates as you type.
- 3When encoding, pick which characters to encode and whether to write named, decimal or hex references.
- 4Copy the result, or press Use as input to run it the other way and check the round trip. Look up any single character in the entity table below the tool.
Frequently asked questions
Is my text sent to a server?
No. Encoding, decoding and the lookup run in your browser, and the list of entity names is part of the page. Copy link only shares the mode and options, never your text.
Do I need entities for accents, symbols and emoji?
Usually not. The HTML Standard requires documents to be encoded in UTF-8, which can hold every character directly, so é, € and emoji can stay as they are. Entities are still handy for invisible characters such as , for characters that are hard to type, and for systems that only pass ASCII text.
Should I use named or numeric references?
Named references like © are easier to read. Numeric ones like © or © work for every character, including the many that have no name. Browsers decode all three forms the same way.
Why does © turn into © even without a semicolon?
For compatibility with old pages, the HTML parser accepts 106 names without the semicolon, such as &, <, © and é. It is still a parse error. Inside an attribute value, a name without a semicolon that is followed by = or a letter or digit is left alone, so a URL like ?a=1©=2 in an href keeps working.
Is ' valid in HTML?
Yes. ' is in the WHATWG list of named character references, so every browser that follows the HTML Standard decodes it to an apostrophe. ' is the numeric alternative.
What does &lt; mean?
It is double encoding: the & of < was encoded again as &. Decoded once, it shows < instead of <. The decoder notices when its result still contains references and offers to decode it again.