Encoding text helps display markup literally. It does not by itself make arbitrary HTML safe to execute.
How to use this html entity encoder / decoder
- Enter text or HTML entities.
- Select Encode or Decode.
- Copy the converted output.
What does an HTML entity encoder do?
HTML entity encoding turns markup-sensitive characters such as <, >, &, quotes and apostrophes into references that a browser displays as text. Use Encode when code examples or user-provided text must appear literally inside an HTML text or attribute context, and use Decode to turn references such as < back into readable characters.
Named, decimal and hexadecimal entities
Named references such as & are easy to read, while decimal and hexadecimal forms such as & and & represent the same ampersand by code point. The browser can decode all valid forms, but keep the semicolon and match the output to the HTML context where it will be inserted.
Is HTML encoding the same as sanitizing HTML?
No. Encoding makes characters display as text; it does not make an HTML string safe to execute or replace a context-aware sanitizer. Keep untrusted values encoded at the output boundary, and never use this simple converter as a substitute for an XSS review or a sanitizer designed for HTML, URL or JavaScript contexts.