HTML Escape / Unescape

Paste text and the tool instantly detects the direction, converting between HTML special characters and character references. It even shows a breakdown of which characters were converted and how many times. Everything runs in your browser.

Idle

โœจ Features

  • Auto-detects escape / unescape direction the moment you paste
  • Shows a breakdown of which characters were converted, and how often
  • Restores named, decimal, and hex character references; can emit numeric references
  • Runs entirely in your browser โ€” your text never leaves your device

๐Ÿช„ Perfect for

Posting code on blogs

Escape HTML source or sample code before publishing so tags are displayed instead of interpreted.

XSS prevention & learning

See exactly how user input changes when escaped, with a breakdown โ€” great for security study.

Restoring scraped HTML

Turn references like & found in scraped pages or API responses back into readable characters.

Embedding in attributes

Convert strings before safely placing them in HTML attributes or templates. Quote escaping is optional.

๐Ÿ”’ Privacy

This tool runs entirely in your browser. The text you enter is never sent to any server.

โ“ FAQ

Why is HTML escaping necessary?

Raw & or < characters are interpreted as tags or character references, causing broken layouts or XSS (cross-site scripting). Converting special characters to references lets them display safely as plain text.

Why does ' become &#39; instead of &apos;?

&apos; is not defined in HTML4, so very old environments may not render it. The numeric reference &#39; works everywhere, so it is used for maximum compatibility.

Which character references can be restored?

Named references like &amp;, decimal references like &#65;, and hexadecimal references like &#x42; are all restored โ€” including the full set of named character references defined in HTML.

Is my data sent anywhere?

No. All conversion happens in JavaScript inside your browser, and your text is never transmitted to any external server.

๐Ÿ”— Related tools

0 chars
0 chars

Conversion breakdown

No characters to convert

Options

The 5 special characters that need HTML escaping

Character Reference Meaning / why it must be escaped
& &amp; Ampersand. Starts every character reference, so it must be escaped first
< &lt; Less-than sign. Interpreted as the start of a tag
> &gt; Greater-than sign. Interpreted as the end of a tag
" &quot; Double quote. Breaks attribute value delimiters
' &#39; Single quote. &#39; is used instead of &apos; for HTML4 compatibility