HTML Entity Encoder and Decoder

Choose Encode or Decode, then pick what to encode: only the characters that are special in HTML, or every non-ASCII character too. Choose named entities such as & and é, or numeric entities in decimal or hex. Decoding handles named and numeric entities, leaves unknown names as they are, and decodes only one layer, so < becomes <.

HTML Entity Encoder and Decoder runs entirely in your browser: the text you paste is never sent to a server. It is free and needs no sign-up.

How to use it

  1. Choose encode or decode In HTML Entity Encoder and Decoder, press Encode to turn characters such as < and & into entities, or Decode to turn entities back into characters.
  2. Choose scope and style When encoding, pick Only the required characters or Also every non-ASCII character. Then pick named, decimal or hexadecimal references such as &eacute;, &#233; or &#xE9;.
  3. Read the result Decoding removes one layer only, so &amp;lt; becomes &lt;. Names outside the common list stay as written, and the tool lists them so you can check them.

Questions

Why must < and & be escaped?

In HTML, < starts a tag and & starts an entity. If raw text such as <b> sits in a page, the browser reads it as markup, so escaping shows it as plain text instead.

What is the difference between named and numeric entities?

Named entities such as &copy; are easy to read, but only for names in the common list. Numeric entities such as &#169; work for any character, so use them when no name is known.