Skip to main content

HTML Entity Encoder/Decoder

November 10, 2025

Encode and decode HTML entities for XSS prevention

Encode and decode HTML entities to prevent cross-site scripting (XSS) attacks and display special characters correctly. All processing happens in your browser.

Input
Enter text containing HTML special characters or entities

Output
Statistics
Input Length:0
Output Length:0
Characters Encoded:0
Entities Found:0
Common HTML Entities
CharacterNamed EntityNumeric EntityUsage
<&lt;&#60;Less than sign (HTML tags)
>&gt;&#62;Greater than sign (HTML tags)
&&amp;&#38;Ampersand
"&quot;&#34;Double quote (HTML attributes)
'&apos;&#39;Single quote/apostrophe
(space)&nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright symbol
®&reg;&#174;Registered trademark
XSS Prevention
When to Encode
  • Before inserting user input into HTML
  • When displaying data from databases
  • Before using in HTML attributes
  • When echoing form data
Essential Characters
  • < prevents script tag injection
  • > closes malicious tags
  • & prevents entity injection
  • " ' prevent attribute breakout