What this does
Escapes any text so it can sit safely inside a JSON string: double quotes, backslashes, line breaks, tabs, and other control characters are replaced by their JSON escape sequences. Paste the result between the quotes of a string value.
Options
- Wrap in quotes returns a complete JSON string literal.
- Escape non-ASCII as \uXXXX writes accented letters, symbols, and emoji (as surrogate pairs) in pure ASCII, which is safest for systems with unreliable encodings.
- Escape / as \/ is optional; it is needed only when JSON is embedded inside an HTML
<script>block.
Details
The Unicode line and paragraph separators (U+2028, U+2029) and unpaired surrogates are always escaped, so the output is valid JSON and valid JavaScript string content.
Example
Input:
She said "hi" C:\Users\ada
Result:
She said \"hi\"\nC:\\Users\\ada
Privacy
Everything runs in your browser. Your input is never uploaded, stored, or put in the page URL.