HTML Entity Encoder and Decoder

Escape or unescape HTML special characters. Results appear as you type.

Loading tool…

  • Free
  • No sign-up
  • Runs in your browser

How to use the html entity encoder and decoder

  1. Choose the direction with the buttons above the result.
  2. Type or paste your text in the top box.
  3. Copy the converted result.

Why escape HTML?

In HTML, < and > mark the start and end of tags and & starts an entity. To show those characters as text, for example when displaying a code sample on a web page, they must be replaced with entities, or the browser will try to interpret them. Escaping is also the basic defense against cross-site scripting (XSS) when inserting user-supplied text into a page.

The five that matter

CharacterEntityName
<&lt;less than
>&gt;greater than
&&amp;ampersand
"&quot;double quote
'&#39;apostrophe

Tick Also encode accented and special characters to convert everything outside basic ASCII, such as é, ©, € and “curly quotes”, into numeric entities like &#233;. That is only needed for old systems that cannot handle UTF-8.

Decoding

The decoder understands named entities (&nbsp;, &copy;, &euro;), decimal entities (&#169;) and hexadecimal ones (&#xA9;). Tags in the input are left as text and never executed.

Frequently asked questions

What is &nbsp;?

A non-breaking space: a space that prevents a line break between two words.

What is &amp;amp;?

An ampersand that has been encoded twice. Decode it once to get &amp;, and again for &.

Is my text stored or sent anywhere?

No. Everything happens inside your browser. Your text is not uploaded, logged or read by anyone. The page remembers your last text on this device only, so you can pick up where you left off; press Clear to remove it.

Related tools