\\t \\n \\\\ \\xFF — C/Java/Python escapes

C-style escape converter

Escapes text using backslash sequences familiar from C, Java, Python, and most other languages: \\n, \\t, \\r, \\\\, \\\", \\', \\xNN, \\uNNNN.

0 chars
escapes to
or unescape
0 chars

How to use this tool

  1. Type or paste text into the Text → C-escaped box — the escaped string appears instantly in C-escaped.
  2. Tick Encode non-ASCII as \xNN hex bytes to turn characters above U+007F into byte-level \xNN sequences.
  3. Tick Escape single quotes too if your string needs \', for example in single-quoted source or shell strings.
  4. Hit Copy result to grab the escaped string to your clipboard.
  5. To go the other way, paste an escaped string into the C-escaped → Text box and the original text appears in Unescaped text.
  6. Use Clear any time to reset a box and start over.

Why this tool is helpful

Write string literals safely

C, C++, Java, Python, Go, and JavaScript all share the same backslash escapes, so one escaped string drops cleanly into most source files.

See invisible characters

Newlines, tabs, nulls, and backspaces become visible \n, \t, \0, and \b, so you can tell exactly what a string really contains.

Embed quotes in strings

Escape \" and \' so a string can hold quotes without terminating the literal, useful when building JSON or shell commands.

Represent non-ASCII bytes

With the hex-bytes option, Unicode text becomes explicit \xNN byte sequences — handy for wire protocols and binary-safe formats.

Round-trip debug output

Escape a payload for storage or a log line, then unescape it later to recover the original text exactly.

Stay private

Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive strings and keys.

FAQ

What is a C-style escape sequence?

It's a backslash followed by one or more characters that stands for a single special character — \n is a newline, \t is a tab, and \\ is a literal backslash.

Which escape sequences are supported?

Escaping produces \n, \t, \r, \\, \", \0, \b, \f, \v, and \xNN for control characters. Unescaping also reads \uNNNN, \UNNNNNNNN, and octal \NNN.

How is non-ASCII text handled?

By default, characters above U+007F pass through unchanged. Tick Encode non-ASCII as \xNN hex bytes to expand them into their UTF-8 bytes as \xNN sequences instead.

Why aren't my single quotes escaped?

Single quotes are only escaped when Escape single quotes too is ticked, since most C-like languages only require escaping double quotes and backslashes.

What's the difference between \xNN and \uNNNN?

\xNN encodes a single byte as two hex digits, while \uNNNN is a four-digit Unicode code unit and \UNNNNNNNN is an eight-digit code point.

Is escaping the same as encryption?

No. Escaping is fully reversible and offers no security — it only makes characters safe to embed in a string literal. Anyone can unescape it back.

Does any of my data leave my browser?

Never. All escaping and unescaping happens locally in JavaScript. Your input is not sent to, stored on, or logged by any server.