HTML Escape/Unescape

Escape and unescape HTML strings — convert special characters to/from entities safely.

EscapeUnescapeSecurityHTML Entities
Plain Text
40 chars
Escaped Output

Output will appear here

Start typing to see live output

All escaping/unescaping happens locally in your browser — your data never leaves your device.

HTML Escape converts special HTML characters to their entity equivalents (<, >, ", ', &).

This tool lets you escape text for safe display in HTML and unescape HTML entities back to readable text.

Essential for safely embedding user-generated content in web pages and preventing HTML injection attacks.

Escaping HTML Tags

Input: <div>Hello</div>
Output: &lt;div&gt;Hello&lt;/div&gt;

HTML tags are converted to their entity equivalents for safe display.

Escaping Quotes and Ampersands

Input: She said "Hi & bye"
Output: She said &quot;Hi &amp; bye&quot;

Special characters are properly escaped to prevent syntax errors.

Unescaping HTML Entities

Input: &lt;p&gt;Hello&lt;/p&gt;
Output: <p>Hello</p>

HTML entities are converted back to their original characters.

Output shows entities instead of rendered HTML

This is correct behavior when escaping — entities display as text, not rendered HTML.

Use the unescaped output if you want to render the HTML in a browser.

Unescaping doesn't work properly

Some text may contain partially-escaped content or mixed entity formats.

Ensure all entities follow the pattern &name; or &#number; without typos.

Why should I escape HTML?

Escaping HTML is crucial for security. It prevents XSS (Cross-Site Scripting) attacks when displaying user-generated content. Unescaped HTML can execute malicious scripts.

What characters get escaped?

The main characters are: < (&lt;), > (&gt;), " (&quot;), ' (&#39;), and & (&amp;). These have special meaning in HTML and must be escaped.

What is the difference between &#39; and &apos;?

&#39; is the numeric character reference for single quotes and works in all contexts. &apos; is the named entity but is not valid in HTML4 (only XHTML/HTML5).

Is my data secure?

Yes. All escaping and unescaping happens locally in your browser. Your data never leaves your device.