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
Result
Common Escape Sequences
Basic Escapes
\\ | Backslash |
\" | Double quote |
\' | Single quote |
\n | Newline |
\r | Carriage return |
\t | Tab |
Advanced Escapes
\b | Backspace |
\f | Form feed |
\v | Vertical tab |
\xHH | Hex escape |
\uHHHH | Unicode escape (JS) |
\U00HHHHHH | Unicode 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:
Sending...
Feedback sent. Thank you!
Error occurred!
-
-
-
-
-
-
-
-
- Acceleration
- Substance Amount
- Angle
- Area
- Astronomical
- Base Converter
- Blood Sugar
- Capacitance
- Electric Charge
- Cooking
- Data Transfer
- Data Storage
- Density
- Energy and Work
- Force
- Fuel Economy
- Illuminance
- Inductance
- Length / Distance
- Power
- Pressure
- Electrical Resistance
- Time
- Speed
- Temperature
- Viscosity
- Volume
- Weight
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-