How to type | on a Spanish keyboard
⌥ Option+1
Hold Option and press “1”.
Not your keyboard? You are viewing: Spanish
Try it on your keyboard: the keys you press light up.
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 || bin C, JavaScript or PHP, and|for bitwise OR; - Markdown tables:
| Column | Value |; - regular expressions:
cat|dogmeans “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: ⌥ Option+1. On French – Numerical: ⌥ Option+⇧ Shift+L.
| on each layout
| System | Layout | Key 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+\ |
Other methods
Character Viewer
Press fn + E (or Control + Command + Space) to open the Character Viewer, search for “|” by name, then double-click it to insert it.
Text replacement
In System Settings › Keyboard › Text Replacements, map a shortcut (for example “;;x”) to the character |: it will be inserted automatically in most apps.
| technical details
| Unicode code point | U+007C |
|---|---|
| Official Unicode name | VERTICAL LINE |
| HTML entity | | |
| CSS | content: "\7C"; |
| JavaScript / JSON | "\u007C" |
| UTF-8 bytes | 7C |
| URL encoding | %7C |
The official name comes from the Unicode Character Database (ICU).
Related characters
Report a mistake
The combination does not work for you? Tell us what happens (macOS version, keyboard, what appears).