JSON escape

Paste any text and get it back escaped, ready to put between the quotes of a JSON string. The result is exactly what JSON.stringify produces.

How it works

  1. Paste your code

    Paste the code in the left box or open a file. No code to hand? Click Example.

  2. Instant result

    The result appears as you type. If there is an error, you see the line and character.

  3. Copy or download

    Copy the result with one click or save it as a file for your editor or project.

What gets escaped?

Double quotes become \", backslashes \\, line breaks \n, tabs \t and other control characters \uXXXX. Everything else stays as it is, including accents and emoji, because JSON is UTF-8 anyway.

Options

  • With quotes around it gives a complete JSON string value, including the outer ".
  • Everything outside ASCII as \uXXXX writes é as \u00e9 and emoji as two \u codes. Use this when the file or system can't handle UTF-8.

Single quotes don't need escaping in JSON, so they stay as they are. To go back, use JSON unescape.

Frequently asked questions

Is the JSON escape free?

Yes. The JSON escape is completely free, with no account, sign-up or usage limit.

Is my code stored?

No. Your code is processed in your browser and is not sent to a server or stored.

Does it work on my phone?

Yes. The tool works in any modern browser on a phone, tablet or computer.