How to type \ (Backslash)

On macOS, U.S. keyboard:

\

See the animated keys

\ on every keyboard

SystemLayoutKey combination
macOS French – Numerical ⌥ Option+⇧ Shift+:
macOS French ⌥ Option+⇧ Shift+:
macOS Belgian ⌥ Option+⇧ Shift+:
macOS Swiss French ⌥ Option+⇧ Shift+7
macOS Canadian Multilingual (CSA) ⇧ Shift+/
macOS Canadian French \
macOS Spanish ⌥ Option+º
macOS Latin American ⌥ Option+'
macOS U.S. \
macOS ABC \
macOS U.S. International – PC \

What is the backslash for?

The backslash \ is mostly used in computing:

  • Windows paths: C:\Users\Jane\Documents;
  • escape sequences in strings: \n for a new line, \t for a tab, \" for a quote;
  • LaTeX commands: \frac{1}{2}, \section{Introduction};
  • regular expressions: \d for a digit, \. for a literal dot;
  • line continuation in shell scripts.

Pitfalls

  • Do not confuse it with the forward slash /, used in web addresses and in macOS and Linux paths. On a Mac, paths use /, never \.
  • On this layout: \. French Mac layouts have no backslash printed on the keys: ⌥ Option+⇧ Shift+:.
  • In some Japanese fonts the backslash is drawn as a yen sign ¥: a display issue, not a keyboard one.

\ technical details

Unicode code pointU+005C
Official Unicode nameREVERSE SOLIDUS
HTML entity\
CSScontent: "\5C";
JavaScript / JSON"\u005C"
UTF-8 bytes5C
URL encoding%5C

The official name comes from the Unicode Character Database (ICU).

Related characters