HomeC/C++ String Escape

C/C++ String Escape

Escape special characters in C/C++ strings, including octal and hexadecimal sequences



Documentation

About C String Escape

This tool converts between plain text and C string literals for source embedding, constants, and protocol text handling.

Key Features

  • C Escape: Handles backslashes, quotes, newlines, tabs, and more.
  • Unescape: Restores sequences such as \\n, \\t, and \\0.
  • Swap I/O: Quickly switch input and output for verification.
  • Sample + Copy: Load sample text and copy output in one click.

Common Sequences

Sequence Meaning
\\n newline
\\r carriage return
\\t tab
\\" double quote
\\\\ backslash
\\0 null char

Steps

  1. Enter source text.
  2. Click escape or unescape.
  3. Copy output into C/C++ code.

FAQ

Why does unescaped output look different?

Input may contain incomplete or mixed escape sequences. Verify original text format first.

Are octal and hex escapes supported?

Common forms are supported. For advanced cases, verify behavior with your compiler/runtime.