String Escape & Unescape Tool

Paste a raw string to escape it for source code, or an escaped string to unescape it back.

Order matters

Escape doubles backslashes first so the passes stay reversible; Unescape resolves the two-character sequences \n \t \r \" \' and finally \\. Feed the output straight into a quoted string literal.

Frequently asked questions

Unicode escapes?

Not generated — characters outside ASCII are left as-is.

JSON-safe?

Yes for the escaped set; control characters other than \n \t \r are uncommon in practice.

Double-escaped input?

Run Unescape twice — each pass removes one level.