HTML Entity Encoder / Decoder
Encode special characters to HTML entities or decode entities back to text.
About HTML Entity Encoding
HTML entities are special sequences that represent reserved characters in HTML. Characters like <, >, &, and " have special meaning in HTML and must be encoded when displayed as literal text to prevent rendering issues and XSS vulnerabilities.
Named vs. Numeric Entities
Named entities use human-readable aliases like & for the ampersand character. Numeric entities use decimal (&) or hexadecimal (&) character codes. Numeric entities can represent any Unicode character, while named entities only cover a predefined set.
When to Use HTML Entity Encoding
Always encode user-generated content before rendering it in HTML to prevent cross-site scripting (XSS) attacks. It is also necessary when displaying code samples in web pages or embedding special characters in HTML attributes.