Skip to content
๐Ÿ”™

Backslash Escape/Unescape

Developer

Escape and unescape backslash characters in strings for JSON, JavaScript, regex, and other programming contexts.

0
0
Input
๐Ÿ”ค

Enter text above to escape for json context

The same backslash means something different depending on what it's headed into next, a JSON string needs one level of escaping, but a string destined to become a regex pattern often needs two, once for the string literal itself and again because regex uses backslash for its own escape sequences, and getting that escaping level wrong by one is a genuinely common, hard-to-spot source of a broken pattern. This tool escapes and unescapes backslash characters for JSON, JavaScript, regex, and other programming contexts, applying the right escaping level for whichever destination the string is actually headed toward.

See more about the Backslash Escape/Unescape

Useful for escaping a string correctly before it gets embedded inside a regex pattern rather than just a plain string literal, unescaping a backslash-heavy string copied from a log file back into its original readable form, or checking exactly how many backslashes a specific context actually requires before pasting a string into code.

Key features

  • Clean interface
  • Fast processing
  • No signup required
  • Works offline

Quick answers for Backslash Escape/Unescape

What contexts does the escaper support?
JSON, JavaScript, regex, HTML, and a general catch-all, each with its own escaping rules, for example JavaScript also escapes angle brackets to \x3C/\x3E, and HTML escapes entities like & and < instead of backslashes.
What's the difference between JSON and JavaScript mode?
JSON mode escapes quotes, backslashes, and whitespace control characters the way a valid JSON string requires. JavaScript mode adds single-quote escaping and also escapes < and > to \x3C and \x3E, useful when embedding a string inside an inline <script> tag.
Can I go from escaped text back to plain text?
Yes. Switch to Unescape mode, or use the Swap button to flip the current output back into the input box with the mode reversed, and the same context-specific rules run in reverse.