Categories
HTML Escape / Unescape
Escape and unescape text for use in HTML.
Overview
Converts HTML special characters (<, >, &, ", ') into safe character references such as < that the browser will not interpret as markup (escape), or converts character references back into the original characters (unescape).
Displaying user input as raw HTML can cause it to be interpreted as unintended tags, leading to XSS (cross-site scripting). Escaping is one of the basic countermeasures against this.
The six entities & < > " ' and ' are supported.
Usage
- 1
Enter the HTML you want to escape, or the escaped string you want to unescape, into the text area.
- 2
Click the "Escape" or "Unescape" button.
- 3
The result is displayed below.
Example
Input
<div class="box">Hello & "World"</div>
Output
<div class="box">Hello & "World"</div>
Use Cases
Escaping user-entered text before displaying it on screen, so it is not interpreted as HTML
Escaping a piece of HTML source so it can be shown as-is in documentation or a code example without the tags actually rendering
Unescaping an already-escaped string received from another system or API to check the original text
FAQ
Which characters get escaped?
The five characters &, <, >, ", and ' are converted to their corresponding character references.
Can numeric character references like ' also be unescaped?
Yes. The six entities & < > " ' and ' are all supported.
Is the text I enter sent anywhere?
No. All escaping and unescaping happens entirely in your browser.
Notes
Escaping is only one part of XSS defense and does not prevent every kind of attack on its own. Combine it with handling appropriate to the display context.
The five characters &, <, >, ", and ' are converted. Other characters are left unchanged.
Unescaping supports the six entities & < > " ' and '. Other character references (such as ©) are left as-is.
Related Tools
Encode and decode text to and from URL encoding.
Break a URL down into its individual components.
Break a query string down into a list of keys and values.