Escape Sequences Reference: \n, \t, \\ and String Escapes
Escape sequences let you put special characters into a string — a newline, a tab, a quote that would otherwise end the string, or a character by its code. A backslash (\) starts an escape. These are near-universal across JSON, JavaScript, Python, Java, C, and more. To see the code point behind any character, use the Unicode converter.
Updated 2026-07-06
| Sequence | Represents | Notes |
|---|---|---|
| \n | Newline (line feed) | The standard line break in most languages |
| \r | Carriage return | Return to line start; part of Windows endings |
| \r\n | Windows line ending | Carriage return + line feed (CRLF) |
| \t | Tab | Horizontal tab |
| \\ | Backslash | A single literal backslash |
| \" | Double quote | A quote inside a double-quoted string |
| \' | Single quote | A quote inside a single-quoted string |
| \0 | Null character | The zero byte (string terminator in C) |
| \b | Backspace | Rarely used in text |
| \f | Form feed | Page break; rarely used |
| \v | Vertical tab | Rarely used |
| \uXXXX | Unicode (4 hex digits) | e.g. \u00e9 = é, \u20ac = € |
| \xXX | Byte / Latin-1 (2 hex digits) | e.g. \xe9 in some languages |
| \u{XXXX} | Unicode code point (ES6) | Braces allow code points above FFFF, e.g. emoji |
The one that trips people up is the backslash itself: to write a literal backslash you need two (\\), because a single one starts an escape. This is why Windows file paths look doubled inside code and JSON strings.
Related tools