💻 Developer Tools

HTML Escape / Unescape

Convert HTML-special characters (< > & " ') to entity references, or turn escaped text back into the original. Handy when pasting code into an article. Everything runs in your browser, so nothing leaves your device.

Examples (click to try)

When you paste, the direction is auto-detected based on whether the text contains entity references like &lt;.

(Enter some text and the result shows up here)

How to Use HTML Escape / Unescape

Enter the text you want to convert in the box above and the result appears instantly. New here? Press one of the "Examples (click to try)" buttons above the input box — it fills in a sample and sets the direction, so a result shows up right away. You can also switch modes manually with the segment buttons.

Example: escaping <p class="x">A & B</p> for an article gives &lt;p class=&quot;x&quot;&gt;A &amp; B&lt;/p&gt;. Paste that into your blog and it displays as literal text instead of being parsed as a tag. Unescaping turns it back into the original <p class="x">A & B</p>.

  • Escape: Converts < > & " ' to entity references (&lt; and so on). The & is handled first, so an entity it creates is not escaped again (escaping already-escaped text will convert its & too).
  • Unescape: Turns entity references back into the original characters. Both named references and numeric references (&#65; / &#x41;) are supported.
  • ⇅ Swap: Moves the result into the input box so you can run the reverse conversion next.

Handy Situations

  • Pasting an HTML code snippet into a blog or documentation without breaking the layout
  • Posting text that contains < or > on a forum or comment field
  • Turning &amp; and similar in fetched HTML source back into readable characters
  • Checking escaped strings embedded inside a template or JSON

Frequently Asked Questions

Is my text sent to a server?
No. Escaping and unescaping happen entirely in your browser. The text you enter is never transmitted to or stored on any external server. You can use this tool with complete confidence, even for sensitive content.
Which characters get escaped?
The five HTML-special characters "&", "<", ">", """, and "'" are converted to "&amp;", "&lt;", "&gt;", "&quot;", and "&#39;" respectively. The "&" is processed first, so an entity reference created in a single pass is not escaped again. Escaping text that is already escaped will also convert its "&", which is intended.
Does unescape handle numeric entity references?
Yes. In addition to named references like "&amp;", it restores decimal numeric references such as "&#65;" and hexadecimal references such as "&#x41;" back to their original characters.