HTML Entity Encoder and Decoder

Encode text so it is safe inside HTML, or decode entities back to readable characters. Everything stays in your browser.

Runs in your browser — nothing you enter is uploaded

HTML Entity Encoder and Decoder

All fields are required unless marked “optional”.

Tip: press Ctrl+Enter (Cmd+Enter on Mac) inside a text box to run.

Your result will appear hereStart typing and it updates instantly.

Formula

  • & → &amp; < → &lt; > → &gt; " → &quot; ' → &#39;
  • &#169; and &#xA9; → ©
  • Numeric entities use the character's Unicode code point, in decimal (&#169;) or hex (&#xA9;)

Entities are text codes that stand for characters with special meaning in HTML.

Worked examples

Encode a snippet

Direction
Encode (text → entities)
Text
<p class="note">Tom & Jerry's © 2026</p>
When encoding
Only & < > " '

Encoded text

&lt;p class=&quot;note&quot;&gt;Tom &amp; Jerry&#39;s © 2026&lt;/p&gt;

Characters escaped: 8

&lt;p class=&quot;note&quot;&gt;Tom &amp; Jerry&#39;s © 2026&lt;/p&gt;

Decode entities

Direction
Decode (entities → text)
Text
Tom &amp; Jerry&#39;s &copy; 2026

Decoded text

Tom & Jerry's © 2026

Entities decoded: 3

Tom & Jerry's © 2026

How it works

Five characters have special meaning in HTML: & starts an entity, < and > delimit tags, and the two quote marks delimit attribute values. To show them as plain text, or to put arbitrary text inside a page, they are replaced with entities: &amp;, &lt;, &gt;, &quot; and &#39;. The encoder also offers to turn every non-ASCII character into a numeric entity such as &#169; for ©, which is useful for systems that only accept ASCII.

The decoder reverses this: it understands numeric entities in decimal and hex, and about sixty of the most common named ones such as &nbsp;, &copy;, &euro; and &hellip;. Anything it does not recognise is left exactly as typed and listed for you, so nothing is silently changed. The result is shown as plain text and is never rendered as HTML.

Escaping is the right way to display untrusted text safely, but it is not a replacement for a sanitiser when you must allow some HTML. For percent-encoding in URLs use URL Encode and Decode, for binary-safe text Base64 Encode and Decode, and to tidy markup use the HTML Formatter.

Assumptions and limits

  • Named-entity decoding covers a common subset, not all 2,000+ HTML entities.
  • The result is plain text only.