String escape tool
Paste a string and escape it for the format you need — or unescape an already-escaped value back to plain text.
About this tool
Escape or unescape strings for JSON, SQL, JavaScript, and regex in one click. Instant, runs in your browser — no install, no signup.
Paste a string and escape it for the format you need — or unescape an already-escaped value back to plain text.
- 1
Paste your string into the input field.
- 2
Select the target language or format: JavaScript, JSON, Python, Java, SQL, or regex.
- 3
Choose Escape or Unescape — the result appears instantly.
- 4
Click Copy to use the escaped string in your code.
Escape a user-supplied string before embedding it in a SQL query or JSON payload.
Escape special characters in a pattern before using it as a regex literal.
Unescape a JSON-encoded string copied from an API response or log file.
Escape for JavaScript
He said "hello"
New lineHe said \"hello\"\nNew lineEscape for JSON
Path: C:\Users\AlicePath: C:\\Users\\AliceThese answers explain common string escape tasks, expected input formats, and edge cases so both visitors and search engines can understand what this tool does.
What characters does JSON escaping handle?
JSON escaping replaces double quotes, backslashes, and control characters (newline, tab, carriage return, and others) with their escape sequences so the string is valid inside a JSON value.
How is SQL escaping different from JSON?
SQL string escaping (ANSI standard) doubles any single quotes inside the string — turning ' into ''. This prevents SQL injection when a value is embedded in a single-quoted SQL literal.
What does regex escaping do?
Regex escaping adds a backslash before every character that has special meaning in a regular expression: . ^ $ * + ? { } [ ] | ( ) \. This makes the string safe to use as a literal match pattern.
When would I need to escape a JavaScript string?
When building a string literal programmatically — for example injecting content into a script tag or a template. JavaScript escaping handles quotes, backslashes, newlines, and other control characters.