Online HTML Escape/Unescape Tool

Convert text to HTML entities and vice versa. Similar to PHP's htmlspecialchars and htmlentities functions.

Enter text containing special characters to convert to HTML entities.

Result:

Enter HTML entities to convert back to plain text.

Result:

About HTML Escaping

HTML escaping is the process of converting special characters in text to their corresponding HTML entities to prevent them from being interpreted as HTML code. This is crucial for:

  • Displaying code examples on web pages
  • Preventing XSS (Cross-Site Scripting) attacks
  • Ensuring the correct display of content that contains characters like <, >, &, etc.
  • Making sure your HTML renders correctly

Common HTML Entities

Character Entity Name Entity Number Description
< &lt; &#60; Less than
> &gt; &#62; Greater than
& &amp; &#38; Ampersand
" &quot; &#34; Double quotation mark
' &apos; &#39; Single quotation mark (apostrophe)
space &nbsp; &#160; Non-breaking space
View More HTML Entities
Character Entity Name Entity Number Description
© &copy; &#169; Copyright
® &reg; &#174; Registered trademark
&trade; &#8482; Trademark
&euro; &#8364; Euro
£ &pound; &#163; Pound
¥ &yen; &#165; Yen
&mdash; &#8212; Em dash
&ndash; &#8211; En dash
« &laquo; &#171; Left angle quotation mark
» &raquo; &#187; Right angle quotation mark
§ &sect; &#167; Section sign
&para; &#182; Paragraph sign
&bull; &#8226; Bullet
&hellip; &#8230; Horizontal ellipsis

Difference Between htmlspecialchars and htmlentities

This tool offers two escape modes, similar to PHP's functions:

  • htmlspecialchars: Converts only special HTML characters (<, >, &, ", ') to entities
  • htmlentities: Converts all applicable characters to HTML entities, including special characters, accented letters, and symbols

For most purposes, htmlspecialchars is sufficient to ensure secure content display.