You press the usual key combination, but an unexpected character appears on screen. The problem is rarely a broken key. The vertical bar, also called a pipe (symbol |, Unicode code U+007C), depends on the keyboard layout active on your system, not just the labels printed on the keys. Accidentally changing the layout is enough to produce a completely different character.
Active keyboard layout: the first thing to check
On Windows, several layouts can be enabled at once. Accidentally pressing Windows + Space switches from AZERTY to QWERTY without warning. The language icon in the taskbar (bottom right, next to the clock) shows the current layout. If it displays “ENG” instead of “FRA”, your shortcuts no longer match the labels printed on the keys.
The same pitfall exists on Mac. macOS lets you add multiple input methods and switch between them using the Fn or Globe key. A physical AZERTY keyboard can work perfectly well with a QWERTY layout if the system is configured that way. For more information about typing the vertical bar on Mac and Windows keyboards, checking the layout is always the first step.
So before looking for a shortcut, check which layout is actually active. Everything else follows from that.

Shortcuts for typing the vertical bar on your setup
Once you’ve confirmed the layout, the shortcut becomes predictable. Here are the most common combinations.
AZERTY keyboard on Windows
Hold down AltGr + the 6 key on the top row (the one that also has the hyphen). The pipe appears immediately. If your keyboard doesn’t have an AltGr key, Ctrl + Alt + 6 produces the same result.
An alternative method uses the numeric keypad: hold down Alt, type 124 on the numeric keypad (not the top row), then release Alt. The character appears when you release the key.
AZERTY keyboard on Mac
Option + Shift + L types the pipe on a standard French Mac keyboard. On some older layouts, the combination is Option + 7. If neither works, the active layout is probably the issue (see the previous section).
QWERTY keyboard
On a QWERTY keyboard (US, UK, or international English), type the vertical bar with Shift + the backslash key (), located above or beside the Enter key, depending on the model. This key usually has both the and | characters printed on it.
Use the Mac Keyboard Viewer to find any symbol
Using an external keyboard or an unusual layout? The macOS Keyboard Viewer shows the characters available for each key in real time, including when you hold down Option or Shift.
To enable it, open Keyboard settings in System Preferences, then check the option that adds the Input menu to the menu bar. Click the Input menu icon and select “Show Keyboard Viewer”. A virtual keyboard appears on screen.
Hold down Option: the characters on the virtual keyboard change. Find the pipe and note its exact position. This method is more reliable than a generic shortcut found online because it reflects your actual setup.

ASCII pipe or Unicode vertical line: telling lookalike characters apart
You’ve typed a character that looks like a pipe, but your code or Terminal command returns an error. The problem may be a lookalike character. Unicode includes several visually similar vertical lines that aren’t interchangeable.
- The standard pipe, U+007C (VERTICAL LINE), is the one used in code, shell commands, and regular expressions. It’s the only one that works as an operator in a terminal.
- The “divides” symbol, U+2223 (DIVIDES, ∣), is a mathematical operator. It looks like a pipe but isn’t recognized by a command interpreter.
- The double vertical line, U+2016 (DOUBLE VERTICAL LINE, ‖), appears in some typographic contexts. It’s wider and can’t replace the pipe.
If you copy and paste a pipe from a web page or PDF, the character you get isn’t always the right one. To check, paste it into a text editor that displays Unicode codes, or type it directly using the keyboard shortcuts in the previous section.
Step-by-step troubleshooting when the pipe doesn’t work
You’ve tried the shortcut, but the character doesn’t appear or a different symbol shows up. Follow these steps in order:
- Check the active layout. On Windows, look at the language icon in the taskbar. On Mac, check the Input menu or open the Keyboard Viewer.
- Try the shortcut for the displayed layout (AZERTY, QWERTY, or another). If the active layout is QWERTY but your physical keyboard is AZERTY, use the QWERTY shortcut.
- If the character appears but doesn’t work in your application, make sure it’s the ASCII pipe (U+007C). Some editors automatically replace characters with typographic variants.
- As a last resort, use the Alt code method (Alt + 124 on the Windows numeric keypad) or copy the character from a reliable source and check its Unicode code.
Most problems typing the pipe are caused by an accidental layout change, not a hardware malfunction. Checking the layout before looking for a shortcut saves you from going in circles with key combinations that don’t match your machine’s actual setup.



