Skip to main content
FixLines

HTML entities encode and decode

Escape text for HTML, or turn entities back into characters.

Editor

Ln 1, Col 10 lines0 words0 characters

HTML entities encode and decode: what it does

Show code or user text safely on a web page by escaping the characters HTML treats as markup. Or go the other way and turn named and numeric entities such as <, © and é back into readable characters.

HTML entities encode and decode: how to use it

  1. Paste your text or HTML.
  2. Choose HTML encode or HTML decode.
  3. Select Apply and copy the result.

HTML entities encode and decode: when to use it

  • Show a code sample or a comparison sign on a web page without the browser reading it as markup.
  • Turn the entities of an HTML export back into readable characters for a document.
  • Prepare user text for a template where quotes and ampersands must be escaped.

HTML entities encode and decode: examples

Escape a snippet

Input

<a href="x">Tom & Jerry</a>

Result

&lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;
Decode it back

Input

&lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

Result

<a href="x">Tom & Jerry</a>
Escape a snippet with quotes

Input

Use "width" > 5 & height

Result

Use &quot;width&quot; &gt; 5 &amp; height

HTML entities encode and decode: questions and answers

Which characters does encoding escape?

The five that matter in HTML: ampersand, less-than, greater-than, double quote and single quote.

Does decoding know every entity?

It decodes all numeric entities and the common named ones. An unknown name such as &unknown; is left unchanged.

Are accented letters encoded as entities?

No. Only the five special characters are escaped; letters such as é stay as they are, which is correct for UTF-8 pages.

Does decoding turn &nbsp; into a normal space?

It becomes a non-breaking space character. Run Remove extra spaces afterwards if you want ordinary spaces.

Is my text sent to a server?

No. Everything runs in your browser on your own device, so your text never leaves it.

Tools people often use together with this one.

More in Encode & decodeBrowse all text tools