How html entity encoder & decoder works
HTML entities are special codes used to represent characters that would otherwise be interpreted as HTML markup. For example, the less-than sign < is encoded as < so it displays as text rather than being parsed as the start of an HTML tag.
This tool encodes five key characters: ampersand, less-than, greater-than, double quote, and single quote. These are the characters that have special meaning in HTML and must be escaped to display as literal text. Decoding reverses the process, converting entities back to their original characters.
Encoding is essential when displaying user-generated content or code snippets on a web page, to prevent XSS attacks and ensure correct rendering. Decoding is useful when extracting text from HTML source. All processing happens in your browser.
Frequently asked questions
What are HTML entities?
HTML entities are codes that represent special characters in HTML. They start with an ampersand and end with a semicolon, like < for < and & for &. They prevent the browser from interpreting these characters as HTML markup.
Why do I need to encode HTML entities?
Encoding prevents the browser from treating special characters as HTML tags. Without encoding, a < symbol would start a new tag. Encoding also prevents XSS attacks by ensuring user input is displayed as text, not executed as markup.
Which characters are encoded?
The five characters that have special meaning in HTML: ampersand, less-than, greater-than, double quote, and single quote. These are the characters that must be escaped to display as literal text in HTML.
Can I decode numeric HTML entities?
Yes. The decoder handles both named entities like < and numeric entities like < (decimal) and < (hexadecimal), converting them back to their original characters.