~/devtools / escape
tool::escape

HTML Entity
Encoder

Encode HTML special characters into entities or decode entities back to characters. & → &amp;, < → &lt;, and more — bidirectional.

ad · 728×90

Special Character Reference

CharEntityDescription
&&amp;Ampersand
<&lt;Less than
>&gt;Greater than
"&quot;Double quote
'&#39;Single quote
&nbsp;Non-breaking space
©&copy;Copyright
®&reg;Registered trademark
&trade;Trademark
&euro;Euro
£&pound;Pound
¥&yen;Yen / Yuan
°&deg;Degree
±&plusmn;Plus-minus
×&times;Multiplication
÷&divide;Division
ad · 300×250
// about this tool

About HTML Entity Encoder

HTML reserves certain characters for its own syntax. The angle brackets < and > define tags, and the ampersand & begins an entity reference. When these characters appear in text content, they must be escaped as HTML entities (&lt;, &gt;, &amp;) to prevent browsers from misinterpreting them as markup.

HTML entities start with & and end with ;. They come in two forms: named (&amp;) and numeric (&#38;). Both represent the same character and work in all modern browsers. Proper escaping is also essential for security — failing to escape user-supplied text before injecting it into HTML is a classic XSS (Cross-Site Scripting) vulnerability.

This tool lets you encode special characters into their HTML entity equivalents, or decode entities back into readable text. A reference table of commonly used entities is included for quick lookup. Useful for writing HTML templates, email templates, documentation, and any scenario where raw text must be safely embedded in an HTML document.

Common Use Cases
  • Escaping user input before inserting it into HTML to prevent XSS
  • Correctly displaying special characters in HTML email templates
  • Showing raw HTML code examples on a web page without rendering them
  • Writing meta title and description tags containing & < > or "
  • Decoding HTML entities from legacy system output
Frequently Asked Questions
Q. What's the difference between &amp; and &#38;?
&amp; is a named entity; &#38; is a numeric (code point) entity. Both represent the same character (&) and behave identically in all modern browsers.
Q. Do I need to encode all Unicode characters as entities?
In UTF-8 encoded HTML5, you can use most Unicode characters directly. Only HTML syntax characters (&, <, >, ", ') must be escaped. Other characters like ©, €, or ° can be used as-is.
Q. How do I escape HTML automatically in JavaScript?
Setting element.textContent automatically escapes HTML. React also escapes strings in JSX automatically. Manual escaping is only needed when using innerHTML or dangerouslySetInnerHTML.