How to use .NET (C#) Escape
- Paste or type the text you want to escape.
- Adjust the options if you need to.
- Copy the escaped result.
About .NET (C#) Escape
C# has two kinds of string literals. A regular one, "...", needs backslash escapes for quotes, backslashes and line breaks. A verbatim one, @"...", takes everything literally except the double quote, which you double. This tool can produce either.
It helps when you embed JSON, XML, a file path or a regular expression in C# code. In Windows paths in particular the backslashes double quickly. A verbatim string is the neater choice there.
What gets escaped
Backslash becomes \\, quotes become \" and \', line break \n, carriage return \r, tab \t, null \0, form feed \f, vertical tab \v. In verbatim mode only " becomes "".