DevToolsForYou
Private by defaultRuns in your browser

String escape tool

Paste a string and escape it for the format you need — or unescape an already-escaped value back to plain text.

Quick samplesUseful for testing
String Escape

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.

No signup requiredRuns in your browserInstant results
How to use
  1. 1

    Paste your string into the input field.

  2. 2

    Select the target language or format: JavaScript, JSON, Python, Java, SQL, or regex.

  3. 3

    Choose Escape or Unescape — the result appears instantly.

  4. 4

    Click Copy to use the escaped string in your code.

Why use this tool?
  • 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.

ExamplesInput → output

Escape for JavaScript

InputHe said "hello" New line
OutputHe said \"hello\"\nNew line

Escape for JSON

InputPath: C:\Users\Alice
OutputPath: C:\\Users\\Alice
Frequently asked questionsCommon questions answered

These 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.