HTML Entities

Escape &, < and > for HTML, or unescape them.

About HTML Entities

An HTML entities encoder and decoder that escapes &, <, >, quotes and a few symbols as named entities, or unescapes named, decimal and hex entities.

How to use

  1. Choose Escape to make text safe to place inside HTML, or Unescape to turn entities back into characters.
  2. Type or paste into the left pane. The result appears on the right as you type, with a Copy button.
  3. Press Clear to start again.

What it supports

  • Escape replaces exactly these 11 characters: & < > " ' © ® € £ ¥ ¢ with &amp; &lt; &gt; &quot; &apos; &copy; &reg; &euro; &pound; &yen; &cent;. Every other character, including emoji and accented letters, passes through unchanged, which is correct for UTF-8 pages.
  • Unescape handles every named entity in the HTML5 list (&nbsp;, &mdash; and the rest), any decimal entity such as &#169; and any hex entity such as &#xA9;, exactly one level at a time: &amp;lt; becomes &lt;, not <.
  • Escape is enough to display user text or code samples inside an element or a quoted attribute. It does not sanitise HTML, strip tags, or make text safe inside a <script> block or a URL.

Example

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

Privacy

Escaping is string replacement. Unescaping hands the text to the browser's own parser inside a detached textarea, whose content is text, so nothing is rendered or run. No request is made, and nothing is stored.

Frequently asked questions

Which characters must be escaped in HTML?
Five: & as &amp;, < as &lt;, > as &gt;, " as &quot; and ' as &#39; or &apos;. The first three matter in text content; the quotes matter inside attribute values. Everything else can be written literally in a UTF-8 document.
What is the difference between &#169; and &#xA9;?
Both are the copyright sign ©. &#169; gives the Unicode code point in decimal and &#xA9; gives it in hexadecimal; any code point up to U+10FFFF can be written either way, with or without a named form such as &copy;.
Does escaping HTML entities prevent XSS?
Escaping &, <, >, " and ' prevents user text from being read as markup when it is placed in element content or a quoted attribute, which stops the most common cross-site scripting. It is not sufficient inside JavaScript, CSS, URLs or unquoted attributes, which need their own encoding.