JSON Escape

Escape text so it can sit safely inside a JSON string.

Result

"He said \"hello\"\nPath: C:\\temp\\file.txt"
1 lines · 45 bytes

What does escaping JSON mean?

A JSON string is wrapped in double quotes, and some characters cannot appear inside it as they are. A quote would end the string, and a real line break would break the line. Escaping replaces them with a backslash code.

A double quote becomes \", a backslash becomes \\, a line break becomes \n and a tab becomes \t. Other control characters become \uXXXX codes. For example, He said "hello" followed by a new line and Path: C:\temp\file.txt turns into one safe line of text.

How to use the JSON Escape

  1. Paste or type the text on the left.
  2. Choose output with quotes or without quotes.
  3. Copy the escaped text.
  4. Place it in your JSON value.

Real situations

When people use the JSON Escape

  • 1

    Embed text in a JSON file

    Paste a paragraph, a template or a snippet of code and get a string you can put straight into a JSON value.

  • 2

    Build an API request body

    When a field must contain text with quotes or line breaks, escape it before you place it in the request.

  • 3

    Store code or HTML in JSON

    Escape markup, SQL or a regular expression so it survives inside a string.

  • 4

    Learn how escapes work

    Type different characters and see which ones change, such as slashes and new lines.

Good to know

  • Choose with quotes if you want a complete JSON string, and without if you will place it between your own quotes.
  • Escape text only once. Escaping it twice doubles each backslash.

FAQ

JSON Escape: questions answered

What characters need escaping in JSON?

The double quote, the backslash and the control characters below a space, such as line break and tab. This tool uses \n and \t for those two and \uXXXX for other control characters.

How do I put a double quote inside a JSON string?

Put a backslash before it. The text He said "hello" becomes He said \"hello\" inside the string.

How do I write a backslash in a Windows path?

Double each one, because a single backslash starts an escape code. C:\temp\file.txt becomes C:\\temp\\file.txt in the JSON string.

What does with quotes versus without quotes mean?

With quotes returns a full JSON string including the outer double quotes. Without quotes returns only the inside, handy when the quotes are already in your template.

How do I reverse the escaping?

Use the JSON unescape tool. It turns \n, \" and \u00e9 back into a line break, a quote and the letter é.

Does the tool change non-English letters?

No. Letters like é or emoji are left as they are, which is valid in JSON. Only quotes, backslashes and control characters are replaced.

Is this JSON Escape free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way