HTML Entity Encode and Decode
Escape special characters to HTML entities or convert entities back to plain text. Free and runs in your browser.
Paste or type, or drop a file on the box.
Runs in your browser. Nothing you enter is uploaded or stored.
How to use the HTML Entity Encode and Decode
- Choose Encode to escape text for use in HTML, or Decode to turn entities back into characters.
- Type or paste into the left box. The result appears on the right as you type.
- When encoding, tick the extra option to also turn accented letters, symbols and emoji into numeric entities.
- Copy the result, or press Swap to send it back the other way.
Questions and answers
- Is my text sent to a server?
- No. Encoding and decoding run entirely in your browser. Nothing you type or paste is uploaded, stored or logged.
- What is an HTML entity?
- An entity is a code that stands for a character in HTML. It starts with & and ends with a semicolon, such as < for < and & for &. Entities let you show characters that would otherwise be read as part of the markup, or that are hard to type.
- Which characters must be escaped in HTML?
- Five: & becomes &, < becomes <, > becomes >, the double quote becomes " and the single quote becomes '. The first three matter everywhere, and the quotes matter inside attribute values. This tool escapes all five.
- Do I need to encode accents and emoji?
- Not if your page is saved and served as UTF-8, which is the standard today: é and 😀 can be written as they are. Encoding them is only needed for old systems limited to ASCII, some email templates, and places where you cannot control the character encoding.
- Does escaping protect against XSS?
- Escaping these five characters is the right defence when untrusted text is placed inside an HTML element or a quoted attribute. It is not enough on its own inside a script block, a style block, a URL or an unquoted attribute, which each need their own kind of encoding. Use your framework’s built-in escaping where you can.
- Which entities can it decode?
- All of them. Named entities such as © and —, decimal ones such as © and hexadecimal ones such as © are all recognised, because your browser’s own HTML parser does the decoding. Any tags in the text are left as text.
Related tools
Base64 Encode and DecodeEncode text to Base64 or decode it back in your browser, with full UTF-8 support. Free, instant and nothing is uploaded.File to Base64Convert an image or any file to a Base64 string or data URI, and turn Base64 back into a file. Runs in your browser.URL Encode and DecodePercent-encode text for use in a URL or decode an encoded URL back to readable text. Free and runs in your browser.Unicode Escape and UnescapeConvert text to Unicode escape sequences and code points, or turn escaped sequences back into readable characters.Text to Hex and BinaryConvert text to hexadecimal, binary or ASCII codes and back again. Free, instant and runs entirely in your browser.