String Escape Online
What is string escaping?
String escaping replaces special characters with a safe sequence so the text can sit inside a JSON string (or other quoted literal) without breaking the syntax. A quote becomes \", a backslash becomes \\, and characters like newline and tab become \n and \t. Without that, a quote in the value would close the string early, and a raw newline would be invalid JSON.
JSON requires escaping quotes, backslashes, and control characters. Optionally, you can escape all non-ASCII as \uXXXX. U+2028 and U+2029 are escaped for safe embedding in inline <script> tags.
Examples:
| Case | Input | Escaped output |
|---|---|---|
| Quotes and backslash | He said "hi" \ path | He said \"hi\" \\ path |
| Newline and tab | line1
line2 indented | line1\nline2\tindented |
| JSON | {"name":"abc"} | {\"name\":\"abc\"} |