Escape Sequence Reference
Reference table of escape sequences for JavaScript, Python, Java, C, and Go.
AdSense
Top banner
| 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?