NV ToolkitFormat · Validate · Convert

Escape / Unescape

C# / .NET String Escape / Unescape

C#-ready string literals from any text — standard escapes plus \uXXXX Unicode, decoded back just as easily.

In short

Escape and unescape .NET / C# string literals online: quotes, backslashes, control characters and \uXXXX Unicode escapes, both directions. Free.

By NaveenKumar T · Updated

Learn: JSON Examples: From Hello World to Real API Payloads

  • Escape & unescape in one tool
  • Handles every special character
  • Instant as you switch modes

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Example

.NET Escape: input and output

A log template with a Windows path and non-ASCII text, escaped for a regular C# string literal.

Text
Log "{level}" written to C:\ProgramData\Contoso\app.log
Señor Ñandú paid €49.99 → receipt #7	✔
C# string content
Log \"{level}\" written to C:\\ProgramData\\Contoso\\app.log\nSe\u00f1or \u00d1and\u00fa paid \u20ac49.99 \u2192 receipt #7\t\u2714

The backslashes doubled and €, ñ, → and ✔ became \u escapes, but the braces around {level} were passed through — double them if this ends up in an interpolated string.

Learn more

.NET escaping rules

C# regular string literals use the C-family escape set — \" \\ \n \r \t \b \f \0 — plus \uXXXX (and \xNN) for Unicode. This tool produces exactly that: paste any text, including multi-line content with quotes and non-ASCII characters, and get a literal that drops between quotes in C#, F#, or VB.NET source without a squiggle.

Unescape mode parses the same grammar back to plain text. If you're working with verbatim strings (@"...") remember their only escape is the doubled quote — for those, this tool's output applies after removing the @ and converting, or simply use regular literals for escaped content.

VB.NET multiline strings

VB.NET doesn't share this backslash grammar at all: a double quote inside a String literal is escaped by doubling it (""like this""), and there is no \n or \t escape sequence. Line breaks either sit directly inside the quotes — VB.NET string literals have allowed embedded newlines since Visual Basic 14 (2015) — or come from vbCrLf / Environment.NewLine. This page's escaped output targets C# and F# source; porting it into VB.NET means turning \" back into a doubled quote and \n back into a real line break, not pasting the backslash form as-is.

Help

Frequently asked questions

Everything you need to know about the .NET Escape.

01How do I escape or unescape .NET here?

Paste your text, pick Escape or Unescape in the Mode select, and press Convert. Escape produces a C#/.NET string literal using the C-family escape set plus \uXXXX Unicode escapes; Unescape parses the same grammar back to plain text.

02Should I use a regular or verbatim (@) string for my content?

Verbatim strings shine for Windows paths and regex (no doubled backslashes); regular strings are better for content with newlines, quotes AND special characters — which is exactly what this tool escapes. If the escaped output looks heavy, the content probably wants to live in a resource file instead of source code.

03Can I paste the output into an interpolated ($"…") string?

Only after doubling the braces. Curly brackets are ordinary characters in a regular C# literal, so the tool leaves { and } untouched — but inside $"…" they open format holes, and you must write {{ and }} yourself. The other escapes are interpolation-safe: \" \\ \n \t, \u0000 for the null character, and \uXXXX for everything from U+007F upward (lowercase hex, which the C# compiler accepts). Verbatim strings are a different grammar again — their only escape is a doubled quote.

Keep working

Related tools

Learn the format

Related guides

All guides →