🔣

String Escape / Unescape Tool

Software · 2 inputs · Free

🔣

String Escape / Unescape Tool

2 inputs

Parameters

What is this tool?

String Escape / Unescape Tool helps developers with encoding, encryption and text processing. Escapes text so it can be embedded safely in a JSON or JavaScript string (\n, \t, \", \\) or turns escape sequences back into plain text; it can also convert non-ASCII characters to \uXXXX and back. The result comes without surrounding quotes, and a malformed escape sequence is reported with its position.

📘 Common mistakes · Worked example
TextOperation

Escapes text so it can be embedded safely in a JSON or JavaScript string (\n, \t, \", \\) or turns escape sequences back into plain text; it can also convert non-ASCII characters to \uXXXX and back. The result comes without surrounding quotes, and a malformed escape sequence is reported with its position.

The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.

Last reviewed: · Methodology and sources

How is it calculated?

Escapes text so it can be embedded safely in a JSON or JavaScript string (\n, \t, \", \\) or turns escape sequences back into plain text; it can also convert non-ASCII characters to \uXXXX and back. The result comes without surrounding quotes, and a malformed escape sequence is reported with its position.

Inputs

ValueUnitExample
Text—Line 1 Tab: "quoted" \ café 😀
Operation—Escape (JSON / JavaScript)

What is this tool?

String Escape / Unescape Tool helps developers with encoding, encryption and text processing. Escapes text so it can be embedded safely in a JSON or JavaScript string (\n, \t, \", \\) or turns escape sequences back into plain text; it can also convert non-ASCII characters to \uXXXX and back. The result comes without surrounding quotes, and a malformed escape sequence is reported with its position.

Common mistakes

  • Writing Windows paths without escaping. In C:\temp\new the \t is decoded as a tab and the \n as a line feed, with no error at all, while a path like C:\Users raises an invalid escape error. Every backslash in a path must be written as \\.
  • Escaping twice. Escape an already escaped text and \n turns into \\n; after one round of decoding you are left with a visible \n instead of a line break.
  • Treating JSON escaping as enough for HTML or SQL. The escape operation does not touch single quotes, slashes or the less-than sign; text containing </script> needs the escaping of its own context before it goes into a page or a query.
  • Using JavaScript-only escapes in JSON. \x41, \v, \0, \' and \u{1F600} are valid in JavaScript but not in JSON, and JSON.parse rejects them.
  • Trying to write an emoji as a single \uXXXX. Characters above U+FFFF need a surrogate pair of two sequences; copying only half of the pair produces an invalid character.
  • Forgetting about the surrounding quotes. The tool returns the result without quotes: you add them when placing the string in code, and you paste only what is between them when unescaping.
  • Overlooking single quotes in a single-quoted JavaScript string. The escape operation targets double-quoted strings; if the result goes between single quotes, each ' in the text must additionally become \'.

📘 String Escape Sequences in JSON and JavaScript: \n, \" and \uXXXX →

Sources

Key terms

TextOperation

Frequently Asked Questions

+String Escape / Unescape Tool — how is it calculated?

Escapes text so it can be embedded safely in a JSON or JavaScript string (\n, \t, \", \\) or turns escape sequences back into plain text; it can also convert non-ASCII characters to \uXXXX and back. The result comes without surrounding quotes, and a malformed escape sequence is reported with its position.

+Which values are required?

Text, Operation.

+Is my data stored?

No. All calculations run in your browser; the values you enter are never sent to or stored on a server. If you press “Save”, the calculation stays only in your own browser and you can delete it at any time.

+Is it free?

Yes, all tools are free and require no sign-up.

Similar tools

Popular Tools

🧮

Free Calculators in One Place

Tax, finance, health, math and more — 500+ tools, all in one place.

Choose your cookie preference to continue

Records the site needs to work (theme, language, favourites) stay in your browser.

This site is free and funded by ads.

With your consent, Google Analytics cookies measure visits and Google AdSense cookies are used to show ads; the data is processed on Google servers abroad.

If you reject, the site works just the same.

Cookie Policy · KVKK notice