Developer Tools
JSON Escape / Unescape
Escape any text into a JSON-safe string, or unescape a JSON string back to plain text. Handles \n, \t, \", \\, and \uXXXX in your browser.
Turn a raw string into a JSON-safe string literal so it can be dropped into JSON.
Keep characters above U+007F as-is. Recommended for UTF-8 JSON files.
Output is just the escaped characters with no surrounding quotes.
All processing runs in your browser. The text you paste is not sent to a server.
How to use
- Pick a direction. Use Escape to turn raw text into a JSON-safe string, or Unescape to decode an escaped string back to plain text.
- Paste your text into the input area on the left. Multi-line input works in both directions.
- For Escape, choose Preserve Unicode (recommended for UTF-8 JSON files) or Escape non-ASCII as \uXXXX, and decide whether to wrap the output in double quotes for a complete JSON string literal.
- For Unescape, surrounding double quotes are stripped automatically and surrogate pairs are paired so emoji decode correctly.
- Read the result on the right. Click Copy output to grab it, or Swap to feed the output back as a new input and verify the round-trip.
About this tool
JSON Escape / Unescape is a two-way string converter for JSON string literals. In Escape mode it takes any raw text (multi-line config, log lines, code, markup, paths with backslashes, smart quotes, emoji) and produces a JSON-safe string body in which every special character is replaced with the correct backslash escape: double quote becomes \", backslash becomes \\, newline becomes \n, carriage return becomes \r, tab becomes \t, backspace becomes \b, form feed becomes \f, and any other C0 control character is emitted as a four-digit \uXXXX escape per RFC 8259. Optional toggles let you escape every character above U+007F as \uXXXX (handy when the destination only accepts ASCII), wrap the output in a pair of double quotes so the result is a complete JSON string literal you can paste directly into a key value, and escape forward slash as \/ for downstream consumers that prefer the legacy form. In Unescape mode the tool reverses the process: paste a JSON-escaped string (with or without surrounding double quotes) and the original text comes back. The decoder understands every standard JSON escape (\" \\ \/ \b \f \n \r \t) and four-digit \uXXXX, including UTF-16 surrogate pairs so emoji and other characters above U+FFFF round-trip correctly. Errors are reported with a precise line and column so a malformed escape inside a long log line is easy to find. The output panel includes character and byte counts, a count of escaped characters or decoded sequences, and a Swap button so you can verify a round-trip in one click. Common use cases include preparing a multi-line value for a Terraform JSON file, embedding HTML or SQL inside an AWS IAM policy, copying an escaped error message out of a server log into a readable form, building a JSON request body in Postman, and double-checking that a JSON string literal in source code matches the original text. All processing runs in your browser, so the strings you paste here never leave your device.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON Formatter
Format, minify, and validate JSON in your browser.
Open tool
DeveloperJSON Diff Checker
Structural compare with paths for added, removed, and changed values.
Open tool
DeveloperBase64 Encoder Decoder
Encode and decode Base64 with full Unicode.
Open tool
DeveloperURL Encoder Decoder
Encode and decode percent-encoded URLs.
Open tool
DeveloperHTML Entity Encoder Decoder
Two-way HTML entity encoder and decoder with named, decimal, and hex modes.
Open tool