Slash Unescaper

Reverses C-style backslash escaping: \n, \r, \t, \", \', and \\ are all resolved back to their literal characters. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

Text copied out of source code or a config file often still carries its backslash escaping, making newlines and quotes show up as literal \n and \" instead of their real characters.

This tool resolves that escaping back to plain text.

What Is Slash Unescaper?

An unescaper that resolves \\, \", \', \n, \r, and \t sequences back to their literal characters, the reverse of Slash-escape a String.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Slash Unescaper Works

A single regex matches a backslash followed by one of the recognized escape characters, and each match is replaced with its literal equivalent in one pass.

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Slash Unescaper

Use it when you've copied an escaped string literal out of code and want to read or reuse the actual text.

It's also useful for cleaning up escaped text pasted from a config file or log.

Often used alongside Slash Escaper and String Unquoter.

Features

Advantages

  • Single-pass, predictable resolution of the common escape sequences.
  • Leaves already-plain text unchanged.

Limitations

  • Only resolves the common escape sequences, not exotic ones like \xNN or \uNNNN.
  • Can't distinguish an intentional literal backslash from one meant to start an escape sequence if the input is ambiguous.

Examples

Unescaping quoted text

Input

Say \"hi\"\nnext line

Output

Say "hi"
next line

Escaped quotes and the newline sequence resolve to their literal characters.

Best Practices & Notes

Best Practices

  • Verify the source's exact escaping convention before assuming this tool covers every case.
  • Pair with Slash-escape a String to test round-trip fidelity.

Developer Notes

The regex `\\(\\|"|'|n|r|t)` matches a backslash-escaped character in one alternation, and a replacer function maps the captured character to its literal form; unmatched backslashes are left untouched rather than stripped.

Slash Unescaper Use Cases

  • Reading an escaped string literal copied from source code
  • Cleaning up escaped text pasted from a log or config file
  • Verifying a slash-escape/unescape round trip

Common Mistakes

  • Assuming every possible escape sequence (like \xNN) is resolved; only the common set is.
  • Running this twice on already-unescaped text expecting further changes.

Tips

  • If output still shows backslash sequences, check whether the text was double-escaped.

References

Frequently Asked Questions