HTML Entity Encoder & Decoder
Escape and unescape HTML special characters (&, <, >, quotes) to prevent XSS attacks and display markup safely.
Technical Specifications & Standards
Replaces XML/HTML reserved characters with character references according to W3C HTML5 and XML specifications: '&' to '&', '<' to '<', '>' to '>', '"' to '"', and "'" to '''.
Verified Technical Example
Escaping a user-provided script snippet before displaying in an HTML block
Frequently Asked Questions
Why is escaping HTML entities critical for web security?
If unescaped user input containing `<` or `>` is inserted into HTML, browsers parse it as executable markup, enabling Cross-Site Scripting (XSS) attacks. Escaping ensures the content renders as plain text.
Does this handle numeric character references?
Yes. Both named entities (like `&`) and numeric entities (like `&` and `'`) are decoded back into their original characters.
Are emojis affected by HTML escaping?
Standard alphanumeric and Unicode characters outside the reserved ASCII set (`<`, `>`, `&`, `"`, `'`) pass through without alteration.
Scope & Technical Limitations
- Escaping entities prevents browser parsing as HTML; it does not replace context-specific sanitizers (e.g., CSS or JavaScript execution contexts).