iGuideSmart

HTML Entity Encoder & Decoder

Escape reserved HTML characters (<, >, &, ", ') into safe named or numeric entities and decode HTML entities back to plain text.

Formula & Calculation Logic

Escaping the five HTML-significant characters prevents unintended tag interpretation and mitigates Cross-Site Scripting (XSS) in raw HTML templates.

Primary Formula

& → &amp; | < → &lt; | > → &gt; | " → &quot; | ' → &#39;

Example: Escape <script>alert("hi")</script>

  1. 1
    Replace <, >, and "
    Character-by-character entity map
    &lt;script&gt;alert(&quot;hi&quot;)&lt;/script&gt;

Essential HTML Named & Numeric Entities

Reserved syntax characters and common typographic symbols.

Showing 12 of 12 reference values
Common HTML entities with named and numeric forms
CharNamed EntityNumericDescription
&&amp;&#38;Ampersand (reserved)
<&lt;&#60;Less-than (opens tag)
>&gt;&#62;Greater-than (closes tag)
"&quot;&#34;Double quote
'&apos;&#39;Single quote / apostrophe
&nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright sign
®&reg;&#174;Registered trademark
™&trade;&#8482;Trademark
—&mdash;&#8212;Em dash
€&euro;&#8364;Euro currency sign
×&times;&#215;Multiplication sign

Practical Real-World Use Cases

Embedding Code Snippets in HTML

Display raw HTML/XML tags inside <pre><code> blocks safely.

Email Templates & CMS Cleanup

Decode double-escaped entities (&amp;nbsp;, &#8217;) from legacy CMS exports.

HTML Entity Encoder & Decoder – Frequently Asked Questions

Why should & be escaped first?
If you escape < to &lt; before escaping &, a subsequent pass would corrupt &lt; into &amp;lt;.
What is the difference between &copy; and &#169;?
&copy; is a named HTML entity while &#169; (decimal) and &#xA9; (hex) are numeric character references representing the exact same Unicode code point (U+00A9).
Does HTML encoding protect against XSS?
Escaping HTML special characters prevents injection inside HTML text nodes and quoted attributes, though URLs and inline JS require context-specific escaping.
View all Developer Tools →