HTML Entity Encoder/Decoder
Encode special characters as HTML entities or decode them back.
About HTML Entity Encoder/Decoder
The HTML Entity Encoder/Decoder converts special characters like less-than, greater-than, ampersand, and quotes into their named HTML entity equivalents (<, >, &, ", ') or numeric character references and decodes them back to the original characters. Correct HTML entity encoding is the primary defense against Cross-Site Scripting (XSS) when inserting user-controlled content into HTML contexts, and is mandatory for correctly rendering reserved characters without them being interpreted as markup.
How to Use
Paste text containing special characters and click Encode to convert all HTML-significant characters to their safe entity equivalents — choose between named entities (&) and decimal numeric references (&) depending on your target context. To decode, paste HTML-encoded text and click Decode to restore the original characters. The tool handles all 253 named HTML5 entities including extended Latin, Greek, mathematical, and typographic characters.
Common Use Cases
- Web developers sanitizing user-supplied text before injecting it into HTML template strings to prevent stored and reflected XSS vulnerabilities in forum posts, comments, and profile fields
- Email template developers encoding special characters in HTML email bodies to ensure ampersand, less-than, and greater-than characters render correctly across all email clients
- Web scrapers and data engineers decoding HTML entities in scraped content — like & appearing as & and as a space — before storing clean text in databases or search indexes
- Technical writers and documentation authors encoding code samples containing angle bracket characters for display in HTML documentation pages without them being parsed as HTML tags
- Security auditors testing XSS input validation bypasses by encoding payloads in numeric and named entity forms to identify filters that decode entities before applying pattern-based XSS detection