Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Escape a plain string into a valid JSON string literal.
Your result will appear here.
This tool escapes plain text so it is safe inside a JSON string -- escaping special characters (quotes, backslashes, newlines, tabs, and other control characters) via JSON.stringify and then removing the surrounding quotes -- useful when hand-embedding text into a string that is already inside a JSON payload or config file.
Paste your plain text. The escaped JSON string literal appears instantly, ready to copy.
The tool runs your text through the standard JSON string encoder and then removes the outer pair of double quotes that the encoder adds. The output is therefore the escaped body of a string, ready to paste between quotes you already have in your JSON file, not a complete quoted literal. This matters: if you paste the result into a spot where you expect the tool to have supplied the quotes, you will be missing them. Add your own opening and closing double quote around the output when you need a full string value.
The characters that get rewritten are the ones JSON does not allow raw inside a string:
Ordinary letters, digits, punctuation, spaces and non-English characters such as accented letters or emoji are left as they are. Forward slashes are not escaped either.
Suppose you have a two-line note with a quote in it: the first line reads She said "stop" and the second line reads C:\temp. After escaping, the single line you get back reads She said \"stop\"\nC:\\temp. Every quote gained a backslash, the line break was replaced by the two-character sequence backslash-n, and the lone backslash in the file path was doubled. Wrapped in quotes, this is a valid JSON string that a parser will turn back into your original two lines.
Because the conversion is done by the browser's built-in JSON handling, it is reliable and fast, and nothing is sent to a server. Very large pastes may make the page sluggish. A lone surrogate character (a broken half of an emoji) is written as a unicode escape in current browsers, which keeps the output valid. If you want to reverse the process, the JSON Unescape Tool on this site does that.
No -- the output has the opening and closing double quotes stripped, so it is the escaped contents only. Add your own quotes around it if you need a complete JSON string literal.
No. The tool removes the outer quotes so you can paste the result inside a string you have already opened. Add a quote at each end if you need a complete string literal.
No. Accented letters, other scripts and emoji are kept as they are, which is valid in JSON. Only quotes, backslashes and control characters are rewritten.
JSON uses the backslash as its escape character, so a literal backslash must be written as two. This is expected and is reversed when the JSON is parsed.
No. The conversion runs in your browser, so pasted content stays on your device.
Reference: MDN Web Docs