# String Escape

> Escape text for JSON and JS strings, or unescape. Runs entirely in your browser — nothing you paste is sent anywhere.

Source: https://toffeekit.com/tools/json-string-escape

**Category:** [Developer](https://toffeekit.com/category/developer) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/json-string-escape

**Also useful for:** escape, unescape, string, json

## How it works

1. Paste your text into the Input box.
2. Choose Escape to make it safe inside a JSON or JS string, or Unescape to reverse it.
3. Copy the result without the surrounding quotes.
4. Press Swap to feed the output back in the opposite mode.

## FAQ

### How do I escape a string for JSON?

Paste the text with Mode on Escape. Double quotes, backslashes, tabs and line breaks are converted to \", \\, \t and \n.

### How do I unescape a JSON string?

Switch to Unescape and paste the escaped text. Sequences like \n and \u00e9 turn back into a real new line and the letter e with an accent.

### Do I include the surrounding quotes?

No. The output is the inside of the string only, so you add your own quotes around it. On input, one pair of outer quotes is ignored.

### How do I put a multi-line text into a JSON value?

Escape it. Each real line break becomes \n, so the whole text fits on one line inside the JSON string.

### Why do I get an Invalid escape sequence error?

The text has a backslash that is not part of a valid JSON escape, or an unescaped control character. Fix the stray backslash and try again.

### Is String Escape free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so what you type or paste never leaves your device. It works on phones and computers alike.

## Privacy

String Escape runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [JSON Formatter](https://toffeekit.com/tools/json-formatter) — Format, minify and validate JSON with clear errors.
- [Base64 Encode / Decode](https://toffeekit.com/tools/base64-encoder) — Encode text to Base64 or decode it back, UTF-8 safe.
- [URL Encode / Decode](https://toffeekit.com/tools/url-encoder) — Percent-encode query values or whole URLs.
- [HTML Entities](https://toffeekit.com/tools/html-entity-encoder) — Escape < > & and quotes, or decode entities.
- [JWT Decoder](https://toffeekit.com/tools/jwt-decoder) — Read a token's header, claims and expiry.
- [Hash Generator](https://toffeekit.com/tools/hash-generator) — MD5, SHA-1, SHA-256, SHA-384 and SHA-512 at once.

