Java & .NET Escape

Escape strings for Java or C# source literals.

About the Java & .NET Escape

Escape a string so it compiles cleanly inside Java or .NET string literals, or unescape \n, \t, \uXXXX sequences back to characters.

Frequently asked questions

Do Java and C# escape rules differ?

For common cases they are identical — both use backslash escapes like \n, \t and \uXXXX. This tool produces literals valid in both.

Are Unicode escapes emitted?

Yes, optionally — useful when the target source file must stay ASCII.

Related tools