HTML Entity Encoder/Decoder

Encode and decode HTML entities for safe display in web pages.

Common HTML Entities

&&
<&lt;
>&gt;
"&quot;
'&#39;
/&#x2F;

💡 Why encode HTML? HTML entities prevent browsers from interpreting special characters as HTML code, protecting against XSS attacks and ensuring text displays correctly.

HTML Entities: Encode & Decode Reference

1. Paste your text or HTML

Paste text containing special characters to encode, or paste HTML with entity codes to decode back to plain text.

2. Encode or decode

Encoding converts characters like < > & into safe HTML entities. Decoding reverses this — converting entities back to their original characters.

3. Copy the result

Copy the encoded output to paste safely into HTML attributes, JSON strings, or anywhere that special characters would break syntax.

Common HTML Entities Reference

CharacterNamed EntityNumericWhen to Use
<&lt;&#60;Inside text content to prevent tag interpretation
>&gt;&#62;Inside text content to prevent tag interpretation
&&amp;&#38;Always encode & in HTML to avoid entity confusion
"&quot;&#34;Inside HTML attribute values using double quotes
'&apos;&#39;Inside HTML attribute values using single quotes
&nbsp;&#160;Non-breaking space — prevents line break between words
©&copy;&#169;Copyright symbol
®&reg;&#174;Registered trademark symbol
&trade;&#8482;Trademark symbol
&euro;&#8364;Euro currency symbol
&mdash;&#8212;Em dash for punctuation in prose
&hellip;&#8230;Ellipsis for truncated text

Why HTML Entity Encoding Matters for Security

The characters < > & " must always be encoded when inserting user-provided content into HTML. Leaving them unencoded allows malicious HTML or JavaScript to be injected into your page — an attack known as XSS (cross-site scripting). Always encode output, never trust raw user input in HTML context.

Frequently Asked Questions

Common questions about HTML Entity Encoder