About the HTML Entity Encoder
The HTML Entity Encoder replaces characters that have special meaning in HTML (&, <, >, " and ') with entities, so the text displays literally instead of being treated as markup. It also converts many common symbols, such as ©, ®, ™, €, £, arrows, maths symbols and curly quotes, to their named entities.
How to use the HTML Entity Encoder
- Paste the text or code snippet.
- Copy the encoded output into your HTML.
Example
Showing code on a page
<div class="box"> becomes <div class="box">, which a browser displays as the original text.
Frequently asked questions
Is this enough to prevent XSS?
Escaping text inserted into HTML element content is an important part of preventing cross-site scripting, but different contexts (attributes, URLs, scripts) need their own handling. Use your framework’s escaping functions in real applications.
Do I need to encode accented letters?
Not on a page served as UTF-8. Encoding is only necessary for the special characters.
Can I reverse it?
Yes, with the HTML Entity Decoder.