.NET Escape/Unescape

Escape and unescape .NET (C#) strings — generate C#-safe escaped strings with Unicode support.

EscapeUnescapeC#.NET
Plain Text
36 chars
Escaped Output

Output will appear here

Start typing to see live output

All escaping/unescaping happens locally in your browser — your data never leaves your device.

.NET (C#) Escape converts special characters to their escape sequences (\n, \t, \uXXXX, etc.).

This tool lets you escape text for safe inclusion in C# string literals and unescape escape sequences back to readable text.

Perfect for creating .NET/C# source code with embedded strings, handling multiline text, and working with Unicode characters.

Escaping Quotes and Backslashes

Input: He said "Hello"
Output: He said \"Hello\"

Double quotes are escaped for use in C# string literals.

Windows Path Escaping

Input: C:\Program Files\MyApp
Output: C:\\Program Files\\MyApp

Backslashes in file paths are properly escaped for C# strings.

Unicode Characters

Input: Hello 世界
Output: Hello \u4e16\u754c

Non-ASCII characters are encoded as Unicode sequences (\uXXXX).

Compiler error: Invalid escape sequence

You may have used an unsupported escape sequence or mixed verbatim and regular string conventions.

Use @ prefix for verbatim strings (no escaping needed) or properly escape sequences in regular strings.

Backslashes appear as single character

Escaped backslashes (\\) in source display as single \ when parsed.

This is correct behavior. In source code, \\ produces a single backslash at runtime.

What is the difference between regular strings and verbatim strings in C#?

Verbatim strings (prefix @) don't interpret escape sequences. Use regular strings when escaping is needed, verbatim strings for paths and raw text.

How do escape sequences work in .NET?

.NET follows similar escape rules to Java and JavaScript. Common sequences: \n (newline), \t (tab), \\ (backslash), \" (quote), \u (Unicode).

Can I use verbatim strings for everything?

Verbatim strings are great for file paths and regex patterns, but they don't support most escape sequences. Use regular escaped strings for other content.

Is my data secure?

Yes. All processing happens locally in your browser. Your data never leaves your device.