String Escape / Unescape

Escape or unescape text for JSON, JavaScript, HTML, or URLs. Everything runs in your browser.

How to escape or unescape a string

  1. Paste your text into the Input box.
  2. Set the Mode to Escape or Unescape.
  3. Choose the Target: “JSON string”, “JavaScript string”, “HTML entities”, or “URL”.
  4. The converted text appears in Output. Copy it, or flip the Mode to reverse the operation.

When to use it

Escape when you need to place a value inside code or markup by hand and keep the surrounding syntax intact: dropping a snippet into a JSON string, a JavaScript literal, or a URL query value. Unescape does the reverse when you pull an already-escaped value out of a log, config file, or API response and want the plain text back.

The “HTML entities” target turns characters like <, >, and & into entities so text displays literally on a page instead of being read as markup. It is the usual step before showing code samples or any user-supplied text inside a web page.

Frequently asked questions

Is the string I paste processed on a server?

No. Escaping and unescaping run entirely in your browser; nothing is transmitted.

Which escape formats are supported?

Four targets: JSON, JavaScript string literals, HTML (entities for & < > " '), and URL percent-encoding. Each works in both directions, escape and unescape.

Does JSON escaping add quotes around the result?

No. It returns just the escaped body, ready to paste between your own quotes. Unescaping accepts the value either with or without the surrounding quotes.

Why does unescaping sometimes fail?

Malformed input: invalid JSON escapes, a broken \u or \x sequence, or a bad percent-encoding like a lone %. Escaping never fails; any string can be escaped.

What entities does HTML unescape understand?

Common named entities like &amp; &lt; &gt; &quot;, plus decimal (&#NN;) and hex (&#xNN;) numeric references. Unknown entities are left untouched rather than causing an error.