JSON Escape Text
Turn raw text into a safe JSON string value: quotes, backslashes, tabs and line breaks all become proper escapes. It runs in your browser, so your text stays private.
- Unlimited runs
- No data leaves the tab
- Optional surrounding quotes
- Unicode escape option
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
JSON escape in three steps
No account, no email, no waiting for an upload.
- STEP 01
Paste your text
Add any text: a SQL query, an HTML snippet, a log message, or a whole file.
- STEP 02
Pick the options
Turn on 'Wrap in double quotes' to get a ready-to-use value, and 'Escape non-ASCII' to write accents and emoji as \u codes.
- STEP 03
Copy the result
The escaped text shows with its character count, ready to paste between quotes in your JSON.
What JSON escape does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Follows JSON rulesDouble quotes, backslashes and control characters such as tabs and line breaks are escaped the way JSON parsers expect.
- With or without quotesGet just the inside of the string, or the whole thing wrapped in double quotes.
- Unicode as \u codesWrite non-ASCII characters as \u escapes when the destination only accepts plain ASCII.
- Works on files tooOpen any text file, not only .json ones, and escape its entire content.
- Character countYou see the length of the result, which helps when a field has a size limit.
Good to know
- It escapes text, not documentsRun it on a value, not on JSON you want to keep structured. To tidy a whole document use the JSON formatter.
- Slash is left aloneA forward slash is not escaped, since JSON does not require it.
- Going backTo reverse the process, use JSON unescape.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use JSON escape
Embed a query in a JSON body
Place multi-line SQL or code into a field without breaking the payload.
Put HTML inside JSON
Escape a snippet with quotes and line breaks for a CMS or template field.
Fix a broken string
Find out what the correct escaped form of a tricky string looks like.
Build test fixtures
Prepare messages with newlines and quotes for a JSON test file.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
What gets escaped
Inside a JSON string, the double quote and the backslash must be escaped, and so must control characters below U+0020. Line breaks become the two-character escape for a newline, and tabs become the escape for a tab.
Other characters, including accents and emoji, can stay as they are. Turn on the Unicode option if you want them written as numeric escapes instead.
Quick tips
Escaping is easy to get wrong by hand, so check the result in context:
- Paste the output between double quotes in your JSON, then run the JSON validator.
- If you also need it safe for a link, apply URL encode afterwards.
- For text going into HTML, use the HTML entity encoder instead.
- To turn an escaped value back into plain text, use JSON unescape.
Escaping versus encoding
Escaping makes text safe inside a JSON string. It is not encryption and it is not Base64. If your goal is to carry binary data or an image inside JSON, use Base64 encode instead.
Questions, answered
How do I escape a string for JSON?
Paste the text here and turn on 'Wrap in double quotes' if you want the full value. Copy the result into your document.
Where is my text processed when I escape it?
On your device. The escaping function runs in this tab, so a private query or message body is not uploaded.
Which characters are escaped?
Double quotes, backslashes, and control characters such as tabs and line breaks. Optionally, every non-ASCII character as a \u code.
Why escape non-ASCII characters?
Some systems only accept plain ASCII. Escaping keeps accents and emoji intact as numeric codes.
Is a forward slash escaped?
No. JSON allows an unescaped slash, so it is left as is.
Can I use it from a mobile browser?
Yes, paste your text, copy the result and paste it into your app. It works in current mobile browsers.