Skip to main content
Toolgin57 tools

HTML Entity Encode / Decode

Loading…

About HTML Entity Encode / Decode

The HTML Entity Encoder / Decoder converts special characters to HTML entities (&, <, >, ", ') or decodes HTML entities back to their original characters. Essential for safely inserting user-supplied text into HTML and for reading entity-encoded content.

HTML entities prevent XSS (cross-site scripting) attacks by ensuring characters with special meaning in HTML — like <, >, and & — are displayed as text rather than interpreted as markup.

This tool encodes the full set of HTML named entities and numeric character references. It handles both named entities (&copy;, &nbsp;, &mdash;) and numeric references (&#169;, &#8212;).

Everything runs in your browser. Your data never leaves your device.

How to Use HTML Entity Encode / Decode

  1. Paste your text or HTML.

  2. Select Encode (text → HTML entities) or Decode (entities → text).

  3. Copy the result.

Examples

Example — Encode HTML characters
Input
<script>alert("XSS")</script>
Output
&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;
Example — Decode HTML entities
Input
&lt;p&gt;Hello &amp; World&lt;/p&gt;
Output
<p>Hello & World</p>

Frequently Asked Questions

Why do I need HTML encoding?

HTML encoding converts characters like < and & that have special meaning in HTML into safe representations (&lt; and &amp;). This prevents XSS attacks and display errors when inserting user input into HTML.

What characters get encoded?

< becomes &lt;, > becomes &gt;, & becomes &amp;, " becomes &quot;, and ' becomes &#39;. These are the five characters with special meaning in HTML.

How do I decode &amp; back to &?

Paste the entity-encoded text and select Decode mode. &amp; becomes &, &lt; becomes <, &gt; becomes >, and so on.

Does it encode all Unicode characters?

The default mode encodes only the five HTML-significant characters. Enable full Unicode mode to encode all non-ASCII characters as numeric HTML entities.

What is &nbsp;?

&nbsp; is the HTML entity for a non-breaking space — a space character that prevents the browser from wrapping the line at that point.