Mode

Result

Enter text or HTML to encode or decode.

How to use this tool

  • Choose Encode to escape text for HTML, or Decode to convert entities back to characters.
  • Tick Also encode non-ASCII characters to write accented letters and symbols as numeric entities.

How it works

Encoding replaces the five characters with special meaning in HTML: & → &amp;, < → &lt;, > → &gt;, " → &quot; and ' → &#39;. Optionally, every non-ASCII character becomes a hexadecimal numeric entity such as &#xE9;. Decoding converts all numeric entities and the commonly used named entities back to characters.

Example

Escaping markup

<a href="x">Tom & Jerry</a> → &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

Privacy and limitations

  • Everything runs in your browser.
  • Decoding supports all numeric entities and about 60 common named entities; rare named entities are left unchanged and counted in a note.
  • Escaping text is one part of preventing cross-site scripting; frameworks should escape output automatically.

Frequently asked questions

When do I need HTML entities?

When showing characters that would otherwise be read as HTML — for example displaying code samples or user-entered text.

Are &#169; and &copy; the same?

Yes. Both produce ©. Numeric entities work for every character; named entities exist only for some.