Online HTML Entity Encoder & Decoder

Escape HTML special characters to prevent XSS injection, or decode HTML entities back into clean readable text.

Runs locally 0 lines • 0 bytes
Results update as you type
Input
Paste or type
Result
Updates as you type
// Converted text will appear here...
About this tool

About the HTML Encode / Decode

Escape and unescape HTML special characters online. Converts &, <, >, ", and ' to standard HTML entities and decodes entities back.

How to use the HTML Encode / Decode

  1. Paste HTML or text containing special characters.
  2. Choose Encode to escape it or Decode to turn entities back into characters.
  3. Copy the safe output into your template or CMS.

HTML Encode / Decode example

Input
<a href="/x">Tom & Jerry</a>
Result
&lt;a href=&quot;/x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

When to use it

  • Showing HTML code samples on a web page without the browser rendering them.
  • Escaping user-provided text before inserting it into HTML to prevent XSS.
  • Cleaning up text exported with &amp; and &quot; entities.

Tip: Always escape &, <, >, " and ' in user content; escaping only < and > still leaves attribute values open to injection.

HTML Special Characters Escape

Safely encodes &, <, >, ", and ' to &amp;, &lt;, &gt;, &quot;, and &#39;.

Named & Numeric Entities

Decodes both named HTML entities (like &copy;, &trade;) and numeric entities (&#169;).

Prevents XSS in Web Templates

Quickly prepare user-supplied content for safe insertion into HTML strings.

Instant Toggle

Switch between Encode (escape) and Decode (unescape) modes with a single click.

FAQ

Common questions

Why do I need to HTML encode characters?

Characters like < and > indicate HTML tags to web browsers. If user input contains these characters without escaping, it can break page layout or cause Cross-Site Scripting (XSS) vulnerabilities.

Which characters are considered HTML special characters?

The five core special characters are & (ampersand), < (less than), > (greater than), " (double quote), and ' (single quote).

Does HTML decode support copyright and symbols?

Yes! It handles all standard HTML character entity references such as &copy;, &reg;, &euro;, and &hearts;.

Is this conversion completely private?

Yes, all entity transformations are processed locally in your browser.