What are HTML entities?
An HTML entity — formally a character reference — is a piece of text that stands for a single character. It starts with & and ends with ;. Named references use a mnemonic such as © for ©, decimal references give the Unicode code point in base 10 (©), and hexadecimal references give it in base 16 (©). All three produce exactly the same character in the browser.
Entities exist for two reasons. Some characters have special meaning in markup — < starts a tag and & starts an entity — so they must be encoded when they are meant as text. Others are simply hard to type or may not survive a system that mishandles character encodings: legacy CMS fields, old email pipelines or a database that is not set to UTF-8. Encoding those as references makes them pure ASCII and therefore indestructible.
This encoder works on Unicode code points, not UTF-16 units, so emoji and other characters outside the Basic Multilingual Plane are converted correctly: 😀 becomes 😀 rather than two broken surrogate references. Choose how much to encode and in which format, then copy the result.
How to use the HTML Entity Encoder
- Type or paste your text, or click Sample to see accents, currency symbols, quotes and an emoji.
- Choose what to encode: only the five HTML-special characters, everything outside ASCII, or every character.
- Pick the format: named entities where a name exists (with a decimal fallback), decimal, or hexadecimal.
- Copy the encoded output. Use the reference table below to look up and copy individual entities.
Example
With Non-ASCII and Named selected, Café “Crème” — 5 € & 😀 is encoded as:
Café “Crème” — 5 € & 😀Named, decimal or hex — which should you use?
- Named entities are the most readable in source code (
,—), but HTML5 defines only about 2,200 names, so most Unicode characters have none. - Decimal references work for every Unicode character and in every HTML and XML parser, which makes them the safest choice for XML feeds and email.
- Hex references match the
U+notation used in Unicode charts, soU+2014is simply—. - For apostrophes this tool writes
'instead of':'was added in HTML5 and is not recognised by HTML 4 parsers and some email clients.
When you do not need entities
If your page is served as UTF-8 (<meta charset="utf-8">, the default for WordPress and modern frameworks), you can type é, € or emoji directly. Only & and < in text, and the quote character used around an attribute value, must be escaped. For that narrower job — showing code in a post — the HTML Escape Tool is simpler.
Frequently Asked Questions
What is the difference between encoding and escaping HTML?
Escaping replaces only the characters that would be interpreted as markup (&, <, > and quotes), which is what you need to display code or insert user text safely. Encoding goes further and can convert any character — accents, symbols, emoji — into a reference. The Special only mode here is equivalent to escaping.
Does encoding protect against XSS?
Escaping & < > " ' prevents text from being parsed as HTML in element content and quoted attributes. It is not enough inside <script> blocks, event-handler attributes, unquoted attributes or URLs such as href="javascript:…", which need context-specific encoding. In application code, use your framework’s escaping rather than a manual step.
Why are emoji encoded as one reference instead of two?
Emoji such as 😀 (U+1F600) are stored in JavaScript as two UTF-16 surrogate units. Encoding those units separately produces invalid references like ��, which browsers render as replacement characters. This tool reads whole code points, so you get the correct single reference 😀.
Can I encode an email address to hide it from spam bots?
Choosing Everything turns each character into a numeric reference, which defeats the simplest scrapers. Browsers decode it instantly, and so do most modern harvesters, so treat it as a light deterrent rather than real protection.
How do I turn entities back into characters?
Paste the encoded text into the HTML Entity Decoder. It understands all named, decimal and hex references, including double-encoded text such as &eacute;.