Backslash Escape & Unescape String Online Escape and unescape string literals.
100% offline
Input26 chars · 1 lines
Output29 chars
Escaped · 29 chars
She said \"hello\"\tand left.

About Backslash Escape & Unescape String Online

A backslash escape converts characters that can't sit safely inside a string literal — newlines, tabs, quotes, and the backslash itself — into their two-character escape forms like \n, \t, \", and \\. It's the step that lets you drop multi-line text into a JSON value, a Go, Rust, or Java string, or a regular expression without breaking the syntax.

This free backslash escape and unescape tool runs both directions: paste raw text to escape it into literal form, or paste an escaped literal to recover the original characters, including \uXXXX and \xHH sequences. Everything happens locally in your browser — nothing you paste is ever uploaded, so it's safe for snippets, config, and secrets alike.

Features

  • Escape raw text to string-literal form and unescape it back
  • Handles \n, \t, \r, \\, \", \', \0, \b, \f and control characters
  • Unescapes \uXXXX and \xHH sequences back to their characters
  • Clear errors on unknown or truncated escapes; works fully offline

How to use

  1. Paste your raw string or an escaped literal into the input pane.
  2. Choose Escape to convert text → literal, or Unescape for the reverse.
  3. Copy the result from the output pane — or clear and start again.

Frequently asked questions

What characters does this tool escape?

It escapes the backslash itself, double and single quotes, and the common control characters — newline (\n), carriage return (\r), tab (\t), null (\0), backspace (\b), and form feed (\f). Any other control character is written as \xHH.

Can it unescape \uXXXX and \xHH sequences?

Yes. Unescape recognises \uXXXX (four hex digits) and \xHH (two hex digits) in addition to the named escapes, so it can recover Unicode characters such as é from \u00e9.

Is backslash escaping the same as JSON encoding?

They overlap but are not identical. JSON uses \uXXXX rather than \xHH and does not allow single-quote escapes. Use this tool for source string literals and regex; use the JSON tool when you need strict JSON output.

Does my data get sent anywhere?

No. All escaping and unescaping happens locally in your browser with plain string operations. Your input never leaves your device.

Everything runs locally in your browser — your input is never uploaded.