Escape Text for JSON Without Uploading

Prepare a string so it can sit safely inside JSON: quotes, backslashes and line breaks are escaped. By default you get the escaped characters only; turn “wrap in quotes” on if you also want the surrounding double quotes that JSON.stringify would add.

This tool runs in your web browser: your files and text are processed on your device and are not uploaded to TidyKit servers. Free, no sign-up.

How to escape a string

1. Paste the raw text. 2. Leave wrap-in-quotes off if you are inserting the result into a string you are building yourself, or switch it on to get a complete JSON string literal. 3. Copy the output.

The text `He said "hi"` becomes `He said \"hi\"` without wrapping, or `"He said \"hi\""` with wrapping.

What this is not

It escapes a string, it does not pretty-print a whole JSON document (use the JSON formatter) and it does not minify one (use minify). The text stays in your browser and is not uploaded.

Frequently asked questions

Is the text uploaded?

No.

Does this validate my JSON?

No. It only escapes a string. Use the JSON validator to check a document.

How are line breaks handled?

They are escaped as \n, in the usual JSON way.

Can I unescape a string here?

This page only escapes. To read an escaped value, paste a full JSON string into the formatter or a small snippet into a tool that parses JSON.

More JSON Tools