CedricScheumann

Any text, JSON, SQL or code fragments

Input never leaves your browser, which is useful for confidential content.

Output with escapes for C#, Razor and JSON

Formatted for `\"`, `\\`, Unicode- and Hex-Escapes.

Typical Use Cases

  • JSON & APIs: Safely paste payloads into `HttpClient` or Minimal API examples.
  • Razor & Blazor: Use inline strings in views or components without syntax errors.
  • Unit tests: Keep expected strings stable in snapshots or assertions.
  • Debugging: Decode error messages and see the original text.

Quick guide

  1. Paste text or code into the left field.
  2. Use “Text → C#” to escape or “C# → Text” to convert back.
  3. Swap fields, adjust and convert again when needed.
  4. Use copy to move the output into your project.

All calculations run locally in the browser: no uploads, no log files, no tracking.

Supported Escape Sequences

The converter supports C# escapes according to ECMA-334 and automatically adds Unicode or hex sequences for non-printable characters.

Standard

  • \n – line feed (LF)
  • \r – carriage return (CR)
  • \t – tab
  • \0, \a, \b, \f, \v
  • \\, \", \' for quotes and backslashes

Unicode

  • \uXXXX – BMP characters (4 hex characters)
  • \UXXXXXXXX – Supplementary Planes
  • Surrogates are combined correctly automatically

Hex

  • \xXX to \xFFFF for flexible length
  • Useful for binary data and control characters

Best Practices for C# Strings

Escaper, Verbatim String or Raw String?

Not every text needs the same C# string type. This overview helps you use the output deliberately instead of escaping blindly.

Classic String

Good for short values, API examples, expected test output and strings that need to fit into existing code lines.

Verbatim String

Good for Windows paths, regular expressions and multi-line texts with few quotes.

Raw String

Good for larger JSON, SQL or HTML blocks from C# 11 onward when readability matters more than maximum backward compatibility.

Frequently Asked Questions

Why do I need a C# string escaper?

Manual escaping is error-prone: one missing `\` or `\"` can break your build. This tool generates correct literals in seconds and makes copy and paste safer.

Are my data stored?

No. All operations run client-side in JavaScript. There are no server requests, logs or telemetry data.

Does the tool support Unicode emoji?

Yes. Characters outside the Basic Multilingual Plane are encoded as `\UXXXXXXXX` so they remain correct regardless of editor.

Can I use the output in Visual Studio or Rider?

The strings are compatible with all C# compilers, including Visual Studio, Rider, VS Code with OmniSharp and build pipelines such as GitHub Actions or Azure DevOps.