HTML Entity Encoder and Decoder

Show code as text on a web page by escaping it, or read text that is full of & and &#…; codes.

Input
Result

How to use

  1. Choose Encode or Decode.
  2. Paste the text or HTML.
  3. Copy the result.

Good to know

Encoding replaces the five characters that have special meaning in HTML: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot; and ' becomes &#39;. That is what you need to show code samples on a page or put text inside an attribute safely.

Turn on "Also encode non-English characters" to write every non-ASCII character as a numeric code (₹ → &#8377;, न → &#2344;). Modern pages saved as UTF-8 do not need this, but some old systems and email tools do.

Decoding understands numeric codes (&#8377; and &#x20B9;) and about 130 common named entities such as &nbsp;, &copy;, &rarr; and &hellip;. Unknown names are left as they are, so nothing is lost.

Questions

Why escape HTML?

So the browser shows the characters instead of treating them as tags. It also prevents injected code when you insert user text into a page.

What is &nbsp;?

A non-breaking space: a space where a line will not wrap.

Is ₹ a named entity?

No. Use &#8377; or simply type ₹ in a UTF-8 page.

Is this the same as URL encoding?

No. URL encoding uses %XX codes for links; entities are for HTML.

Is my text uploaded?

No. It runs in your browser.

Last updated: