HTML Escape/Unescape
Convert special characters to their HTML entity equivalents or decode HTML entities back to regular characters.
Input
Output
About HTML Escaping
HTML escaping converts special characters to their HTML entity equivalents to prevent them from being interpreted as HTML markup.
Common HTML entities:
- & becomes &
- < becomes <
- > becomes >
- " becomes "
- ' becomes '
When to use HTML escaping:
- When displaying user-generated content on a webpage
- When inserting text into HTML attributes
- When working with text that might contain HTML or JavaScript code
- When preventing XSS (Cross-Site Scripting) attacks
When to unescape HTML:
- When you need to display the original text from HTML entities
- When processing stored HTML content for display
- When working with text that has been previously escaped