Encode special characters to HTML entities or decode entities back to readable text. Supports named, numeric, and extended character entities.
HTML entities are character sequences that replace reserved characters in HTML. By replacing tags like < and > with their entity equivalents (< and >), you prevent browsers from mistakenly treating text as HTML code strings. This is a fundamental technique for preventing Cross-Site Scripting (XSS) attacks.
Named entities are easy to read and remember (e.g., © for ©). Numeric entities use the character's exact Unicode position, formatted either as decimals (©) or hexadecimals (©). Numeric entities are advantageous because they cover every character in the Unicode specification, whereas named entities only exist for the most common symbols.
If your HTML document is properly encoded as UTF-8 (using the <meta charset="UTF-8"> tag), you rarely need to encode non-ASCII characters like emojis or foreign alphabets. You only inherently need to encode the five reserved HTML characters: <, >, &, ", and '.