Escape / Unescape

Turn text into a valid string literal, or a literal back into text, for 11 formats.

Runs locally · nothing uploaded
Text
Escaped

What it does

Paste text and get it escaped for the language you are writing, or paste an escaped literal and get the original text back. The output updates as you type.

FormatEscaping rules
JSON string\" \\ \n \t \uXXXX
C# string\" \\ \0 \a \n \u, \U and \x escapes
C# verbatim @"..."quotes doubled: ""
C# raw """..."""picks a delimiter longer than any run of quotes in the text
JavaScript '...', "...", `...`\xHH, \u{...}, line continuations, \${ in templates
SQLsingle quotes doubled: ''
CSV fieldquoted only when needed, quotes doubled
XML / HTML& < > " '; unescape decodes named and numeric entities
Regular expressionbackslash before . * + ? ^ $ ( ) [ ] { } | / \

Notable features

  • Unescape accepts the literal with or without its quotes, so you can paste @"C:\temp" or 'O''Brien' straight from code.
  • Precise errors: an invalid escape such as \q in C# is reported with line and column. Warnings flag text that would break the literal, such as an unescaped quote.
  • Escape non-ASCII writes every non-ASCII character as an escape, useful for source files that must stay ASCII.
  • Swap feeds the output back in and flips the direction to check a round trip.

Raw string literals take line breaks from the source file, so a lone carriage return cannot be represented exactly.

Privacy

Everything runs in your browser. Your input is kept in local storage only.