Check wrappers and quote style
The default produces a complete JSON literal with double quotes. Select Body only for a string without its outer quotes. For JavaScript, match the selected quote to the literal you are reading; the tool does not guess.
Encoding and escaping
Escape and unescape in one editor, and keep the original text with undo.
Escape: text → escaped text; Unescape: escaped text → text. Each unescape handles one layer. Options apply to the next action; a failed conversion keeps the content.
Enter text or load an example. Empty input can be converted.
0 UTF-16 units
The table describes only the latest successful conversion: the value before escaping, or the restored value after unescaping. After a manual edit or an option change, the old table and report no longer describe the current text. Rows follow code points, and isolated surrogates are marked.
Choose a context explicitly. JSON uses strict string syntax; JavaScript accepts a documented subset. Unicode accepts only the selected escape form, one layer at a time. Options affect the next action and do not rewrite the current text.
Initial input: up to 1,048,576 UTF-16 units. Output and further processing of generated documents: up to 4,194,304 units. Empty input is valid; pasting may normalize line endings.
Conversion stays in this browser; input is not uploaded. Undo history stays in this tab and is bounded for large documents.
String escape helps when a value copied from a log must become a JSON string, or a JavaScript literal needs to become readable text. A visible backslash followed by n differs from an actual newline: selecting the destination syntax makes that distinction explicit.
Use string unescape for one encoded layer at a time. The character table shows what the value contains, including invisible controls, supplementary emoji and isolated UTF-16 units that a normal text editor may conceal.
String escape keeps JSON escape and JavaScript escape separate. JSON uses double quotes and a narrower escape set; JavaScript offers a selected single- or double-quoted form. Body mode removes only the wrapper convention, not the syntax checks.
An emoji can be one code point and two UTF-16 units. Inspect the underlying value before exporting; isolated surrogate units remain identifiable instead of being silently replaced.
The default produces a complete JSON literal with double quotes. Select Body only for a string without its outer quotes. For JavaScript, match the selected quote to the literal you are reading; the tool does not guess.
Escape and Unescape both read the current text. Editing or changing options does not convert it. Ctrl/Cmd+Enter escapes, and Ctrl/Cmd+Shift+Enter unescapes. Each unescape removes one layer.
The original is captured before the first conversion. Edits, conversions, restoring the original, examples and clearing share undo and redo. The character table and JSON report describe only that successful conversion and need a new run after a manual edit. Copy and TXT use the full current text, except when it contains isolated surrogates.
In JSON and JavaScript, enable non-ASCII escaping when the destination requires it. Otherwise readable Unicode remains readable. The tool can escape quotes and backslashes without normalizing the underlying text.
Unicode escape mode encodes every character, including ASCII. Choose one \uXXXX per UTF-16 unit or \u{…} per code point; the decoder accepts only that selected notation and retains ordinary text.
Malformed sequences report a line and column where available. A rejected conversion does not return a repaired or partial string, so the next edit can target the offending input.
The JSON report includes input, output, the underlying value, options and up to 100 character rows. Its escaped strings preserve isolated surrogates that a UTF-8 text export cannot retain unchanged.
JSON allows a small fixed set, including \n and \uXXXX, inside double-quoted strings. JavaScript also supports forms such as \xHH and single-quoted literals. This String escape tool deliberately rejects some valid JavaScript forms, including identity escapes, so its accepted subset stays explicit.
A single newline becomes the two visible characters \n. Unicode output can represent one UTF-16 unit with six characters such as \u0041. These are longer written representations, not extra characters added to the restored value.
Yes, when the same context and form are used, the conversion preserves the UTF-16 value without normalization. Clipboard pasting may alter line endings. Use the JSON report if the restored result contains isolated surrogate units.
Complete literal includes the selected outer quotes; Body only does not. JSON always uses double quotes. Standalone Unicode mode has no surrounding quotes. Choose the matching form explicitly when decoding.
Click Unescape. Each click removes one layer from the current text, including edits you just made. The page does not unescape recursively or switch direction by itself. If the restored text contains isolated surrogates, copy and TXT stay disabled until you escape it into a legal form; the JSON report of that conversion keeps the original units.
Found a string edge case?
Use String escape with a quote, a newline and an emoji, then inspect the underlying characters before exporting.