HTML Entity Encoder / Decoder

Convert characters to HTML entities and back. Supports named, decimal, and hex encoding.

Encoding Mode

Plain Text
HTML Encoded
+36characters  ·  Input: 45 ·  Output: 81

Free online HTML entity encoder and decoder

HTML entity encoding is a fundamental part of web security and content rendering. Characters like <, >, and & must be escaped before being rendered inside HTML to prevent them from being interpreted as markup. This tool provides four encoding modes: essential, all-named, decimal, and hex: covering every use case from basic XSS prevention to full Unicode escaping.

The built-in Reference tab gives you a searchable table of named HTML entities, useful when you need to look up the correct code for a symbol like ©, ®, or an arrow. Whether you're sanitising user input, writing email templates, or debugging entity-encoded content, all processing happens instantly in your browser without sending data anywhere.

Step-by-step guide

  1. 1
    Choose Encode, Decode, or Reference
    Use the tabs to select whether you want to encode text to HTML entities, decode entities back to plain text, or browse the reference table.
  2. 2
    Select an encoding mode
    On the Encode tab, choose Essential (< > & &quot; &apos;), All named entities, Decimal (&#123;), or Hex (&#x7B;) depending on your use case.
  3. 3
    Paste your input text
    Type or paste the text you want to encode or the entity-encoded string you want to decode into the input area.
  4. 4
    Review the output
    The encoded or decoded result appears instantly on the right, with a character count delta shown below.
  5. 5
    Copy the result
    Click the Copy button next to either panel to grab the result and paste it into your HTML, template, or code editor.

Related Tools

Frequently Asked Questions

What are HTML entities?
HTML entities are special sequences used to represent characters that have a meaning in HTML markup (&lt;, &gt;, &amp;) or characters outside the ASCII range. They take the form &amp;name; (named), &amp;#123; (decimal), or &amp;#x7B; (hexadecimal).
When should I encode HTML entities?
Encode entities whenever you display user-generated text in an HTML context to prevent XSS (cross-site scripting) attacks. You should also encode them when embedding special characters like copyright symbols, arrows, or accented letters in HTML.
What is the difference between Essential and All Named modes?
Essential mode encodes only the five characters that have special meaning in HTML: &lt; &gt; &amp; &quot; and &apos;. All Named mode additionally converts common symbols like &copy; &reg; &euro; and arrows to their named entity equivalents.
Does this tool send my text to a server?
No. All encoding and decoding runs entirely inside your browser. No data is transmitted anywhere.
Can this tool decode numeric entities like &#128; or &#x80;?
Yes. The Decode tab handles named entities (&amp;amp;), decimal numeric entities (&amp;#123;), and hex numeric entities (&amp;#x7B;) all at once.
What is the Reference tab for?
The Reference tab shows a searchable table of all supported named entities with their character, entity name, decimal code, and hex code. Use it to look up the correct entity for any symbol.
Is &amp;apos; a valid HTML entity?
&amp;apos; is defined in XML and XHTML but was not part of the original HTML4 spec. In HTML5 it is fully valid. For maximum compatibility with older HTML parsers, use &amp;#39; or &amp;#x27; instead.
Why does encoding increase character count?
Each encoded entity takes more characters than the original symbol. For example &amp; becomes &amp;amp; (5 chars). The character delta shown below the panels lets you track this expansion.

AlteredIdea vs alternatives

vs server-side tools: Everything runs in your browser: your data never leaves your device.

vs VS Code extensions: No install needed. Works instantly in any browser.

vs paid tools: Completely free, no account required.