Search tools

Find a tool by name or what it does.

String Escape / Unescape

Escape or unescape a string using the rules of JavaScript, JSON, Java, Python, SQL, CSV, and shell.

Direction

Converted live as you type. Everything runs in your browser. Nothing is uploaded.

Language

Quote style

Options

Output is a complete literal with its surrounding quotes. Non-ASCII characters are kept as-is.

How to escape and unescape a string online

  1. Choose a direction

    Pick Escape to turn text into a string literal, or Unescape to decode a literal back to raw text.

  2. Select the target language

    Choose JavaScript, JSON, Java, C#, Python, SQL, CSV, or shell so the correct escaping rules are applied.

  3. Paste your input

    Type or paste your text or literal, and the result updates on every keystroke.

  4. Adjust and copy

    Set the quote style and options if you need to, then use Copy to clipboard to take the result away.

Why use this tool

Seven language targets

Escape and unescape for JavaScript, JSON, Java, C#, Python, SQL, CSV, and shell, each using its own rules for quotes and special characters.

Correct special-character handling

Quotes, backslashes, tabs, newlines, carriage returns, and other control characters become valid escape sequences, so the output drops into code without syntax errors.

Quote style and non-ASCII options

Pick the quote character, keep or drop the surrounding quotes, and optionally rewrite anything outside plain ASCII as \u sequences where the language supports them.

Unicode and surrogate pairs

High code points such as emoji are escaped as the right pair of \u units for JavaScript and JSON, or as a single wide escape for Python, and decode back cleanly.

Clear errors on broken input

Unescape reports a lone trailing backslash or a \u sequence with too few digits as an unterminated escape instead of returning wrong text.

Runs entirely in your browser

Everything happens on your device, and nothing is uploaded.

About this tool

This tool converts a string to and from the escaped form used by a programming language. In escape mode it takes raw text and produces a safe string literal, turning quotes, backslashes, tabs, newlines, and other control characters into the escape sequences that the chosen language understands. In unescape mode it reads a literal and gives back the original characters. Pick from JavaScript, JSON, Java, C#, Python, SQL, CSV, and shell, and switch direction with a single tap.

Each language follows its own rules. JavaScript, Java, C#, and Python use backslash escapes such as \n and \t, and can rewrite anything outside plain ASCII as \u sequences, with surrogate pairs handled correctly for emoji and other high code points. SQL and CSV double their quote character instead of using a backslash, and shell offers both single-quote and double-quote styles. You can choose the quote character, keep or drop the surrounding quotes, and turn ASCII-only output on or off where it applies.

Unescape is careful about broken input. A string that ends in a lone backslash, or a \u sequence with too few digits, is reported as an unterminated escape rather than silently producing wrong text. Everything runs on your device, so tokens and secrets inside your strings never leave the page. For a single JSON value see the JSON escape tool, for \u work outside a specific language see Unicode escape, and to tidy a full query use the SQL formatter.

Frequently asked questions

What does string escaping do?
It converts characters that have special meaning inside a string literal, such as quotes, backslashes, and newlines, into escape sequences the language accepts. The escaped text can then sit inside a literal without breaking the surrounding code.
Which languages are supported?
JavaScript, JSON, Java and C#, Python, SQL, CSV, and shell. Backslash languages use sequences like \n and \t, while SQL and CSV double their quote character and shell offers single-quote and double-quote styles.
What are the quote style and non-ASCII options?
Quote style picks the character that wraps the literal, for example double, single, or backtick, and controls which quote gets escaped. The non-ASCII option rewrites accented letters, symbols, and emoji as \u sequences for languages that support them.
How does unescape handle broken input?
It decodes valid escape sequences back to their characters and unwraps surrounding quotes. If the input ends with a stray backslash or has a \u sequence with too few hex digits, a short message explains the problem instead of returning a wrong result.
Does it handle Unicode and emoji?
Yes. Characters outside ASCII pass through unchanged by default. Turn on the non-ASCII option to rewrite them as \u sequences, with surrogate pairs emitted correctly for high code points, and unescape converts those sequences back to the original character.
Is my data uploaded anywhere?
No. Everything runs in your browser. Your text is processed on your device and never sent to a server, stored, or logged.

Related tools