Online HTML Escape/Unescape Tool
Convert text to HTML entities and vice versa. Similar to PHP's htmlspecialchars and htmlentities functions.
Escape HTML
Unescape HTML
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 |
---|---|---|---|
< | < |
< |
Less than |
> | > |
> |
Greater than |
& | & |
& |
Ampersand |
" | " |
" |
Double quotation mark |
' | ' |
' |
Single quotation mark (apostrophe) |
space | |
  |
Non-breaking space |
View More HTML Entities
Character | Entity Name | Entity Number | Description |
---|---|---|---|
© | © |
© |
Copyright |
® | ® |
® |
Registered trademark |
™ | ™ |
™ |
Trademark |
€ | € |
€ |
Euro |
£ | £ |
£ |
Pound |
¥ | ¥ |
¥ |
Yen |
— | — |
— |
Em dash |
– | – |
– |
En dash |
« | « |
« |
Left angle quotation mark |
» | » |
» |
Right angle quotation mark |
§ | § |
§ |
Section sign |
¶ | ¶ |
¶ |
Paragraph sign |
• | • |
• |
Bullet |
… | … |
… |
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.