How to type | (Vertical bar)

On macOS, U.S. keyboard:

⇧ Shift+\

See the animated keys

| on every keyboard

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

What is the vertical bar for?

The vertical bar |, also called “pipe”, is essential in the terminal and in programming:

  • Unix pipe: it sends one command’s output to the next, ls -l | grep .txt;
  • logical OR: a || b in C, JavaScript or PHP, and | for bitwise OR;
  • Markdown tables: | Column | Value |;
  • regular expressions: cat|dog means “cat or dog”;
  • in mathematics, absolute value: |x|.

Pitfalls

  • Some PC keyboards show a broken bar ¦ on the key. That is a different character (U+00A6): code needs the solid bar |.
  • Do not confuse it with lowercase l, the digit 1 or capital I: they look alike in some fonts.
  • On this layout: ⇧ Shift+\. On French – Numerical: ⌥ Option+⇧ Shift+L.

| technical details

Unicode code pointU+007C
Official Unicode nameVERTICAL LINE
HTML entity|
CSScontent: "\7C";
JavaScript / JSON"\u007C"
UTF-8 bytes7C
URL encoding%7C

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

Related characters