Short answer: Press the \ key on its own (no Shift) — it’s above Enter on a US keyboard, or beside the left Shift on a UK one, and it’s the same key that makes | with Shift. On Windows you can also hold Alt and type 92 on the numeric keypad. On German layouts it’s hidden behind AltGr + ß.
The backslash is one of many special keys — see the full set with names in the keyboard symbols guide, or grab any character from the Alt Code Finder.
The backslash, ** (formally the reverse solidus), is the mirror image of the forward slash and does two big jobs in computing: it separates folders in Windows file paths, and it’s the universal escape character in code. The first thing to nail down is which slash is which.
\ vs / — backslash vs forward slash
They lean opposite ways and do opposite jobs:
- \ — backslash (reverse solidus, leans left): Windows file paths (
C:\Users\Name), escape characters, regex, and LaTeX. Never used in web addresses. - / — forward slash (solidus, leans right): web URLs (
https://…), Mac/Linux file paths (/home/user), dates and division. The universal one.

Why the split? Unix (1969) used / for paths; when DOS/Windows arrived, / was already taken for command-line options, so Microsoft used ** as the path separator. Modern Windows tolerates forward slashes in many places (C:/Users often works), but ** is still the officially recommended separator — while Unix and macOS reject backslashes in paths entirely. So cd C:\Users fails in a Linux terminal, and a URL must always use /.
Quick reference
| Item | Value |
|---|---|
| Windows / Mac (US/UK) | the \ key (no Shift), above Enter / by left Shift |
| German layout | AltGr + ß (Windows) · Option + Shift + 7 (Mac) |
| Windows Alt code | Alt + 92 |
| Word | 005C then Alt + X, or Insert → Symbol |
| HTML | \ / \ |
| Unicode | U+005C (REVERSE SOLIDUS) |
Type \ on Windows
- The \ key on its own (above Enter on US, beside left Shift on UK).
- German (QWERTZ): AltGr + ß.
- Alt code: hold Alt, type 92 on the numeric keypad, release.
- Word:
005C+ Alt + X, or Insert → Symbol → Basic Latin. Character Map also works (search “reverse solidus”).
Type \ on Mac
Press the \ key above Return on US/UK layouts. On German Mac keyboards it’s Option + Shift + 7 (or Option + ß). There’s no single universal Mac shortcut beyond the key itself — if your layout hides it, open the Character Viewer (Control + Command + Space) and search “backslash.”
The backslash as an escape character
In almost every programming language, \ means “treat the next character specially.” It introduces escape sequences:
\n= newline,\t= tab,\\= a literal backslash,\"= a quote inside a string,\0= null.- Regex piles on more:
\da digit,\wa word character,\swhitespace,\ba word boundary.
Because a single \ triggers escaping, writing a literal backslash needs \\ — and in a regex inside a string you can end up with \\\\ to match one backslash, a mess nicknamed “leaning toothpick syndrome.” It’s why JSON stores a Windows path as C:\\Users\\file, and why Python offers raw strings (r"\d") to avoid the double-escaping.
The backslash in file paths
- Windows:
C:\Users\Name\Documents; network (UNC) paths start with two,\\server\share. - Mac / Linux / URLs: use forward slashes instead —
/home/user,https://example.com. - Cross-platform tip: let your language’s path library join folders rather than hard-coding a slash, so the same code works on every OS.
The backslash in LaTeX & maths
- LaTeX / TeX: every command begins with a backslash —
\alpha,\frac,\begin(see LaTeX math symbols). - Maths:
A \ Bdenotes set difference (the elements in A but not B); there’s also a dedicated symbol, ∖ (U+2216). Swapping the plain backslash and the set-minus can quietly break both a proof and a file path, so keep them straight.
Type \ on Linux, ChromeOS & phone
- Linux / ChromeOS: the \ key; or Ctrl + Shift + U, type
005c, Enter. - Phone: tap the 123 / symbols key, then the second symbols page — \ is usually there.
What the backslash is
The backslash — formally the reverse solidus, and nicknamed slosh, whack, hack or “escape” — was added to ASCII by Bob Bemer in the 1960s, originally so ALGOL programmers could build the Boolean operators */* (and) and / (or). Its path-separator and escape-character roles came later and made it one of the most-used punctuation marks in computing.
Troubleshooting
| Problem | Fix |
|---|---|
| My file path won’t work on Mac/Linux | Those systems use forward slashes — replace \ with /. |
| A URL with \ is broken | URLs only use /. Never put a backslash in a web address. |
| My string shows \n literally / drops characters | You need to escape the backslash: use \\ for a literal one (or a raw string). |
| The \ key types something else | Wrong layout, or it’s hidden (German: AltGr + ß) — check your layout or use Alt + 92. |
| \ vs ∖ in a formula | The plain backslash (U+005C) and the set-minus ∖ (U+2216) are different characters — use the right one. |
Recap
- Type it → the \ key (no Shift); Alt + 92 on Windows; AltGr + ß on German.
- \ vs / → backslash = Windows paths + escapes; forward slash = URLs + Unix paths.
- Code → escape character (
\n,\t,\\), regex, LaTeX commands.
Frequently asked questions
How do I type the backslash ()?
Press the \ key by itself — it’s above the Enter key on a US keyboard and beside the left Shift on a UK one, and it’s the same key that makes | with Shift. On Windows you can also hold Alt and type 92 on the numeric keypad. On German layouts, use AltGr + ß.
What’s the difference between \ and /?
The backslash () leans left and is used in Windows file paths, escape sequences, regex and LaTeX. The forward slash (/) leans right and is used in web addresses, Mac and Linux file paths, dates and division. A URL always uses the forward slash; a backslash is never valid in a web address.
What does the backslash do in programming?
It’s the escape character: it tells the computer the next character has a special meaning. \n is a newline, \t is a tab, \\ is a literal backslash and \" is a quote inside a string. In regular expressions it also forms classes like \d (digit) and \w (word character), and in LaTeX it begins every command.
Why does Windows use \ in file paths while the web uses /?
Unix used the forward slash for file paths from 1969. When DOS and Windows came along, the forward slash was already used for command-line options, so Microsoft adopted the backslash as the path separator instead. Modern Windows tolerates forward slashes in many places, but the backslash remains the official separator.
Where is the backslash key?
It’s its own key — above the Enter key on a US layout, and beside the left Shift key on a UK layout — and it shares that key with the pipe (|), which you get by adding Shift. On German keyboards the backslash is hidden behind AltGr + ß.
What does \ (double backslash) mean?
In code and data formats, \\ represents a single literal backslash, because one backslash on its own would start an escape sequence. It’s why JSON writes a Windows path as C:\Users\file. A double backslash also begins a Windows network (UNC) path, as in \server\share.
Written by Igor R.. Tested on Windows 11, macOS and US, UK keyboard layouts. Symbol code points follow the Unicode Standard. Last updated July 2026.