String escape & unescape
Escape or unescape JSON, JavaScript and Java strings without running code. Choose quote handling and copy the result. Free, local browser processing.
Enable JavaScript to use this interactive tool. Paste input, choose options, then copy or download the result, or save it to your notebook.
Details and limits
Escape or unescape JSON, JavaScript, or Java string literals without evaluating code. JSON uses double quotes; JavaScript accepts single/double quotes, hex and Unicode escapes; Java accepts Unicode and octal escapes.
Example and common questions
Escape a line break for a JSON string
- Direction
- escape
- String language
- json
- Quotes
- include
first
second"first\nsecond"Which language should I select?
Choose the intended JSON, JavaScript or Java string rules. Their supported escapes differ; an escape accepted for JavaScript may be invalid for Java or JSON.
Should quotes be included?
Use include for a complete quoted string literal. Use content-only for escaped text without its surrounding quotes. The setting applies when escaping and unescaping.
Does this execute code?
No. The tool reads and transforms supported string literals without evaluating source code or running a program.
Common errors and limitations
Check for incomplete quoted literals, unsupported escapes and unescaped line breaks inside a literal. Match the selected language and quote setting to the input.