String Escape / Unescape

Escape text for JSON and JavaScript strings (quotes, newlines, tabs) and reverse it.

Loading tool…

Escape and unescape strings

The String Escape tool prepares text for use inside JSON and JavaScript string literals by escaping the characters that would otherwise break them — double quotes, backslashes, newlines, and tabs. It also reverses the process, turning an escaped string back into readable text. Everything runs in your browser.

Why escaping is needed

When you embed text inside a quoted string, certain characters have special meaning. A double quote ends the string early, a backslash starts an escape sequence, and a literal newline is invalid inside a JSON string. Escaping replaces these with safe sequences like \", \\, \n, and \t, so your string stays valid and your data survives intact.

How to use it

  1. Choose Escape to make text safe for a string literal, or Unescape to reverse it.
  2. Paste your text.
  3. Copy the result, or use Swap to feed it back in.

Common escape sequences

CharacterEscaped
Double quote\"
Backslash\\
Newline\n
Tab\t

When you'll use it

  • Embedding text in JSON — pasting a multi-line value into a JSON field.
  • Hardcoding strings in code — putting content into a JS/TS string.
  • Debugging — unescaping a string from a log or API response to read it.
  • Config files — safely including special characters.

Escape vs encode

String escaping is different from URL or Base64 encoding. Escaping targets string-literal syntax (quotes, backslashes, control characters), while URL encoding targets characters unsafe in a URL and Base64 turns binary into text. Use this tool specifically when your text needs to live inside a JSON or JavaScript string.

Private and free

All processing happens in your browser — nothing is uploaded. The tool is completely free with no sign-up.

Frequently asked questions

What does escaping a string do?

It replaces characters that would break a string literal — quotes, backslashes, newlines, tabs — with safe escape sequences like \n.

Is this the same as URL encoding?

No. This targets JSON/JavaScript string syntax. URL encoding and Base64 are different and serve other purposes.

Can I unescape too?

Yes. Switch to Unescape to turn an escaped string back into readable text.

Is my data private?

Yes. Everything runs in your browser and nothing is uploaded.