HTML Entities Encoder & Decoder

Escape <, >, &, quotes and optionally all non-ASCII as HTML entities, or turn entities back into literal text without rendering HTML.

Options

Input

Ctrl + Enter to run

Result

Escape HTML special characters (&, <, >, double and single quotes) to show literal text inside a page or an attribute without it being parsed as markup. Optionally convert everything non-ASCII into &#x…; numeric references.

It also works in reverse: numeric references and the most common named entities become text. The result is always shown as text: nothing is rendered as HTML.

How to use it

  1. Choose Encode or Decode.
  2. Paste the text or HTML.
  3. Press Run.

Example

Example input
<a href="/buscar?q=1&r=2">Café "La Ñ"</a>
Result
&lt;a href=&quot;/buscar?q=1&amp;r=2&quot;&gt;Café &quot;La Ñ&quot;&lt;/a&gt;

Limitations

  • Decoding recognizes a documented subset of named entities (&amp;, &nbsp;, &eacute;, &euro;…); unknown ones are left intact and reported.
  • Escaping is necessary but not sufficient against XSS in JavaScript, CSS or URL contexts.

FAQ

Do I need to escape quotes?
Yes, when the text goes inside an attribute. This tool always escapes " as &quot; and ' as &#39;.
Is it safe to paste HTML with scripts?
Yes: the HTML is never executed or rendered, only treated as text.

Related tools

References