Free Online HTML Entity Encoder & Decoder — Escape Special Characters

Convert between HTML entities and plain text. Encode special characters like <, >, &, and " for safe HTML display, or decode entity references back to readable text.

Input
Output
Common HTML Entities
CharacterEntityNumericDescription
&&amp;&#38;Ampersand
<&lt;&#60;Less than
>&gt;&#62;Greater than
"&quot;&#34;Double quote
'&#39;&#39;Single quote (apostrophe)
 &nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright
®&reg;&#174;Registered
&trade;&#8482;Trademark
&euro;&#8364;Euro sign
£&pound;&#163;Pound sign
¥&yen;&#165;Yen sign
°&deg;&#176;Degree
±&plusmn;&#177;Plus-minus
×&times;&#215;Multiplication
÷&divide;&#247;Division
&mdash;&#8212;Em dash
&ndash;&#8211;En dash
&hellip;&#8230;Ellipsis
&lsquo;&#8216;Left single quote
&rsquo;&#8217;Right single quote
&ldquo;&#8220;Left double quote
&rdquo;&#8221;Right double quote
é&eacute;&#233;e acute
ñ&ntilde;&#241;n tilde
ü&uuml;&#252;u umlaut

What Are HTML Entities?

HTML entities are escape sequences that represent special characters in HTML. Characters like <, >, &, and " have special meaning in HTML syntax, so they must be "escaped" when you want them displayed as literal text on a web page.

An HTML entity starts with & and ends with ;. There are three formats: named entities (&amp;), decimal numeric (&#38;), and hexadecimal numeric (&#x26;). Named entities are easier to read, but numeric entities can represent any Unicode character.

Encoding is essential when displaying user-generated content to prevent XSS (Cross-Site Scripting) attacks. Decoding is useful when you need to read or edit content that has already been entity-encoded.

How to Use

  1. Choose Encode or Decode mode.
  2. Paste your text into the input area.
  3. Optionally toggle "Encode non-ASCII characters" for full encoding.
  4. The output updates instantly as you type.
  5. Click Copy to grab the result. Use the reference table below for quick lookups.

When You Need This

Displaying code snippets in HTML

When writing a tutorial and showing HTML code examples, you need to encode < and > so the browser shows them as text rather than parsing them as tags.

Preparing content for CMS input

Some CMS systems or email templates expect pre-encoded HTML. Encode your content here before pasting it into a WYSIWYG editor that strips special characters.

Decoding escaped content for editing

When you pull content from a database or API that stores HTML entities, decode it here to read and edit the actual text.

Preventing XSS in templates

When inserting dynamic values into HTML templates manually (without a framework that auto-escapes), encode them first to prevent script injection.

Tips

1.

Always encode user input in HTML context

Any value that came from user input and will be rendered in HTML must be entity-encoded. This prevents XSS attacks where users inject <script> tags.

2.

Use named entities for readability

&amp; is more readable in source code than &#38;. Use named entities for common characters and numeric entities only for unusual Unicode characters.

3.

Don't double-encode

If content is already encoded (&amp; is already there), encoding again turns it into &amp;amp;. Check whether your framework auto-encodes before manually encoding.

4.

Decode before processing text

If you need to search, count words, or transform text that contains entities, decode it first to work with the actual characters.

Examples

Encode HTML tags

Escapes angle brackets so they display as text.

Input

<script>alert("XSS")</script>

Output

&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;

Decode named entities

Converts entity references back to characters.

Input

&lt;p&gt;Hello &amp; welcome&lt;/p&gt;

Output

<p>Hello & welcome</p>

Limitations

  • Encodes named entities for common characters only. Obscure Unicode characters are encoded as numeric references (&#x...;) rather than named entities.
  • Does not handle full HTML documents — it processes text content only, not HTML tags or attributes.
  • Cannot decode malformed or incomplete entity references (e.g., &amp without the semicolon).
  • Reference table shows common entities only, not the full 2000+ named character references defined in HTML5.

Features

  • Encode text to HTML entities (named and numeric)
  • Decode named, decimal, and hexadecimal entities back to text
  • Optional non-ASCII character encoding for full escaping
  • Common entities reference table with character, name, and numeric code
  • Instant conversion as you type
  • 100% client-side, your data stays in your browser

FAQ

What's the difference between named and numeric entities?

Named entities like &amp; use memorable labels. Numeric entities like &#38; (decimal) or &#x26; (hex) use code points. Named entities are more readable but only exist for common characters.

When should I use the "Encode non-ASCII" option?

Enable it when you need to ensure your HTML is pure ASCII — for example, when targeting systems that don't handle UTF-8 well, or for older email clients.

Does this tool handle all HTML5 named entities?

It handles the most commonly used entities (50+). For rare named entities, use the numeric format (&#code;) which supports any Unicode code point.

Is my data sent anywhere?

No. All encoding and decoding runs in your browser using JavaScript. No network requests are made. Your content stays completely private.

Should I encode content in React/Vue/Angular?

Modern frameworks auto-escape content rendered with {variable} or {{ variable }}. You only need manual encoding when using dangerouslySetInnerHTML (React) or v-html (Vue).

Content last reviewed: June 2026

Your Privacy

All encoding and decoding happens entirely in your browser. No data is uploaded to any server. Your text never leaves your device.

Tips & Related Workflows