HTML Entity Encoder
Encode HTML special characters to entities or decode HTML entities back to readable text.
HTML entities are used to display reserved characters in HTML without triggering browser interpretation. The less-than sign (<) must be written as < in HTML to prevent the browser from treating it as a tag opening. Ampersands (&) become &. This is essential when displaying user-supplied content in web pages to prevent cross-site scripting (XSS) vulnerabilities.
Common HTML entities
< produces <. > produces >. & produces &. " produces ". ' or ' produces '. produces a non-breaking space. © produces ©. ® produces ®. — produces —.
Frequently asked questions
Why do I need HTML entity encoding for user input?
If you display user-submitted text in a web page without encoding it, a user can inject HTML or JavaScript that runs in other visitors' browsers. This is a cross-site scripting (XSS) attack. Encoding converts <script> to <script>, which displays as text instead of executing as code.