HTML Entity Encoder/Decoder

Easily encode characters into HTML entities for safe web display, or decode encoded strings back to plain text. Prevents XSS and ensures correct rendering of special characters.

Common Entities

<
&lt;
>
&gt;
&
&amp;
"
&quot;
'
&apos;
©
&copy;
®
&reg;
™
&trade;
&nbsp;
€
&euro;

About the HTML Entities

Switch to Encode to turn characters like <, > and & into safe HTML entities, or to Decode to turn entities such as &amp;lt; back into readable text.

Everything you enter is processed in your browser; nothing is uploaded or stored.

How to use it

  1. Choose Encode or Decode.
  2. Paste your text or HTML.
  3. Copy the result; use the Common Entities table for quick reference.

Why HTML entities are needed

Some characters have a special meaning in HTML: < and > open and close tags, and & starts an entity. To show them as text they must be written as &lt;, &gt; and &amp;. Encoding also writes accented and other non-ASCII characters as numeric entities such as &#233; for é.

Encoding user-supplied text before putting it into a page is a basic defence against HTML injection, and it is the only way to display code snippets inside HTML.

Example

<p>Tom & Jerry</p> encodes to &lt;p&gt;Tom &amp; Jerry&lt;/p&gt;, which a browser displays as the literal tag text.

Frequently asked questions

What is &nbsp;?

A non-breaking space: it looks like a space but stops a line from breaking at that point.

Do I need to encode quotes?

Inside attribute values, encode the quote character used to delimit the attribute (&quot; or &#39;).

Is this the same as URL encoding?

No. URL encoding uses % codes (%20) for URLs; use the URL Encoder/Decoder for that.