ToolGlint

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

  1. Choose Encode to escape text for use in HTML, or Decode to turn entities back into characters.
  2. Type or paste into the left box. The result appears on the right as you type.
  3. When encoding, tick the extra option to also turn accented letters, symbols and emoji into numeric entities.
  4. 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 &lt; for < and &amp; 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 &amp;, < becomes &lt;, > becomes &gt;, the double quote becomes &quot; and the single quote becomes &#39;. 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 &copy; and &mdash;, decimal ones such as &#169; and hexadecimal ones such as &#xA9; are all recognised, because your browser’s own HTML parser does the decoding. Any tags in the text are left as text.

Related tools