Free online tools to generate, calculate, convert, format, transform, and de/en-code.
 

Es/Unescape Strings

Escape and unescape special characters in strings for various programming languages and formats including JavaScript, Python, C/C++, JSON, and Regex.


Mode

Format

Input

Common Escape Sequences

Basic Escapes
\\Backslash
\"Double quote
\'Single quote
\nNewline
\rCarriage return
\tTab
Advanced Escapes
\bBackspace
\fForm feed
\vVertical tab
\xHHHex escape
\uHHHHUnicode escape (JS)
\U00HHHHHHUnicode escape (Python)

About String Escaping

String escaping is the process of converting special characters into escape sequences that can be safely included in string literals. Different programming languages use different escape conventions.

Why Escape Strings?

  • Special Characters: Include quotes, newlines in strings
  • Code Safety: Prevent syntax errors and injection
  • Data Transfer: Safely transmit strings in JSON, URLs
  • Unicode: Represent non-ASCII characters portably

Language Differences

  • JavaScript/JSON: Uses \uXXXX for Unicode
  • Python: Supports raw strings (r"..."), \UXXXXXXXX
  • C/C++: No native Unicode escapes, uses \xHH
  • Regex: Special metacharacters need escaping
Security Note: Always properly escape user input before including it in code, SQL queries, or HTML to prevent injection attacks.

Feedback

Help us improve this page by providing feedback:


Share with