Escape Sequence Reference
Reference table of escape sequences for JavaScript, Python, Java, C, and Go.
| Sequence | Description | Example | Languages |
|---|---|---|---|
| \n | Newline (line feed) | "line1\nline2" | JavaScriptPythonJavaCGo |
| \r | Carriage return | "hello\rworld" | JavaScriptPythonJavaCGo |
| \t | Horizontal tab | "col1\tcol2" | JavaScriptPythonJavaCGo |
| \\ | Backslash | "C:\\Users" | JavaScriptPythonJavaCGo |
| \" | Double quote | "say \"hi\"" | JavaScriptPythonJavaCGo |
| \' | Single quote | 'it\'s' | JavaScriptPythonJavaCGo |
| \0 | Null character | "end\0" | JavaScriptPythonJavaCGo |
| \a | Alert (bell) | "\a" | PythonJavaCGo |
| \b | Backspace | "abc\b" | JavaScriptPythonJavaCGo |
| \f | Form feed | "page\f" | JavaScriptPythonJavaCGo |
| \v | Vertical tab | "\v" | JavaScriptPythonJavaCGo |
| \xNN | Hex byte value (2 digits) | "\x41" = "A" | JavaScriptPythonJavaCGo |
| \uNNNN | Unicode escape (4 hex digits) | "\u0041" = "A" | JavaScriptPythonJavaGo |
| \u{N...} | Unicode code point (variable length) | "\u{1F600}" = emoji | JavaScriptPython |
| \UNNNNNNNN | Unicode escape (8 hex digits) | "\U0001F600" | PythonGo |
| \NNN | Octal escape (1-3 digits) | "\101" = "A" | PythonJavaCGo |
| \? | Question mark (trigraph avoidance) | "\?" | C |
| \N{name} | Unicode character by name | "\N{SNOWMAN}" | Python |
Was this page helpful?
Related tools
About Escape Sequence Reference
Escape and unescape string literals, revealing control characters like \n, \t, and \uXXXX. Useful for embedding text safely in code and for reading escaped strings from logs.
How to use
- Paste raw text to escape, or an escaped string to unescape.
- Choose the direction.
- Copy the result into your code or config.
Frequently asked questions
- Which escapes are supported?
- Common ones such as \n, \t, \r, \\, quotes, and \uXXXX unicode escapes.
- Why escape strings?
- Escaping lets you embed newlines, quotes, and special characters in string literals without breaking the syntax.