HTML Entity Encoder Decoder
Escape text into HTML entities such as < and é, or decode any named, decimal or hex entity back to characters.
Tool guide
What this tool does
HTML Entity Encoder Decoder escapes the characters that have special meaning in HTML and, if you wish, every non-ASCII character, using named, decimal or hexadecimal character references. The decoder understands all HTML5 named references as well as numeric ones, and can unwrap text that was encoded twice.
Five characters change meaning in HTML: “<” and “>” open and close tags, “&” starts a character reference, and quotes end attribute values. Pasting text containing them straight into a page can break the layout or, worse, let injected markup run as code. Escaping them as < > & " and ' makes the browser display them literally.
The encoder always escapes those five characters and can additionally convert non-ASCII characters, for templates or email systems that only accept ASCII. Choose named references where HTML defines them (é, ©, —), or decimal and hexadecimal numeric references, which work for every Unicode character including emoji. The decoder uses your browser’s own HTML parser in a safe text-only context, so all 2,231 HTML5 named references decode exactly as a browser would, and no tags or scripts are ever created.
How to use HTML Entity Encoder Decoder
- Paste your text or HTML into the Input box, or click Sample.
- Select Encode or Decode under Mode.
- When encoding, choose which characters to convert and the reference style: named, decimal or hexadecimal.
- Switch off “Encode quotes” only when the text goes into element content rather than an attribute.
- Copy the output, or use “Use output as input” to verify that decoding restores the original.
Tips for better results
- Numeric references work everywhere; a few named ones, such as ', are not recognised by very old HTML 4 parsers.
- If you see “&amp;” in a page, the text was escaped twice. Decode with the double-encoding option.
- Converting every character is a simple way to hide an email address from basic scrapers, though it is not real protection.
- In JSX and most template engines, text is escaped automatically, so pre-encoding it produces visible entities.
Common use cases
- Showing an HTML code snippet as text in a blog post or documentation page.
- Cleaning product descriptions exported from a CMS full of and ’.
- Preparing ASCII-only HTML for legacy email templates.
- Decoding entity-laden text from an RSS feed or API response.
Common mistakes to avoid
- Escaping only “<” and forgetting “&”, so existing text such as “©” turns into a symbol by accident.
- Using HTML escaping for JavaScript or URL contexts, which need their own rules; see String Escaper and URL Encoder.
- Encoding text that will be passed through a framework that escapes it again, causing double encoding.
Frequently asked questions
Which characters must always be escaped in HTML?
In element content, “<” and “&” are essential and “>” is recommended. Inside attribute values you must also escape the quote character that delimits the value, so encoding both " and ' is the safe default.
What is the difference between é and é?
Both mean “é” (code point U+00E9). The first uses the decimal number 233, the second the hexadecimal number E9. Browsers treat them identically.
Does decoding run any HTML or scripts?
No. Decoding happens inside a detached textarea element, which treats its contents purely as text, so tags are never created and scripts never execute.
Are emoji supported?
Yes. Characters without a named reference, including emoji such as 😊 (😊), are written as numeric references using their full code point.
Feedback & suggestions
Help us improve HTML Entity Encoder Decoder. We read every message.