The absolute value symbol is a pair of vertical bars wrapped around a value, like |x| or |-5|. The bar itself already sits on your keyboard: press Shift + \ (the backslash key, usually just above Enter).
It works the same on Windows, Mac, and Chromebook. Type one bar before your number and one after.
Because the vertical bar lives on a standard key, you rarely need a special code for it. The table below covers the key, the Windows Alt code, and the Unicode, HTML, and LaTeX values for the times you do. For codes to other characters, see the full Alt code list.
Every way to type the absolute value symbol
| Method | Input | Works in |
|---|---|---|
| Keyboard key | Shift + \ (backslash) | Every app and OS |
| Windows Alt code (decimal) | Alt+0124 | Most Windows apps |
| Mac | Shift + \ | Most Mac apps |
| Word / PowerPoint (hex) | 007C then Alt+X | Word, Outlook, OneNote |
| Excel / Sheets | =UNICHAR(124) | Spreadsheets |
| HTML | | or | | Web pages |
| Unicode (hex) | U+007C VERTICAL LINE | Universal |
| LaTeX | \lvert x \rvert | Math typesetting |
On Windows
The fastest route is the key: hold Shift and press \ (backslash), the key above Enter on most US layouts. If your layout hides it, hold Alt, type 124 on the numeric keypad, then release.
The Alt-code method needs a real number pad, so on a compact laptop the Shift + \ key is your friend. For codes to other symbols, the Alt code finder lists them all.
A note on codes: Alt+0124 and Alt+0124 both give the solid bar |. Watch for Alt+0166, which produces the broken bar ¦, a separate character; the zero-less Alt+0166 reads from your regional code page and usually lands on ª. For absolute value, 124 is all you need.
On Mac
Press Shift + \ (backslash), the same key as on a PC. No Option combination is needed, because the bar is a standard character rather than a special one.
If you would rather insert it from a menu, open the Character Viewer with Ctrl + Cmd + Space and search for “vertical line. “
In Microsoft Word and PowerPoint
Type the bars directly with Shift + \. For a tall expression, like a fraction sitting inside the bars, open the equation editor with Alt + = and build the absolute value there so the bars stretch to match the height.
If you ever need the character from its code, type 007C and press Alt+X to convert it. The same equation editor and the Insert → Symbol route both work in PowerPoint and OneNote.
In Excel and Google Sheets
Type the bar with Shift + \, or return it with a formula: =UNICHAR(124) or =CHAR(124). Here is the catch that trips people up. The vertical bars are only text in a spreadsheet, so to actually compute absolute value you use the ABS function.
=ABS(A1) turns -8 into 8. In a Google Sheets cell, press F2 to enter edit mode before pasting a symbol from elsewhere.
In Google Docs
Type the bar straight from the keyboard with Shift + \. To pick it from a menu, go to Insert → Special characters and search “vertical” or draw the shape in the box. For proper math with auto-sized bars, use Insert → Equation and type your expression between two bars.
On iPhone and Android
On an iPhone, tap the 123 key, then the #+= key; the vertical bar sits with the other symbols there. On Android’s Gboard, tap ?123
, then the =\< key to reach the second symbols page and tap the bar. If you type absolute value often on a phone, set up a text replacement (iOS: Settings → General → Keyboard → Text Replacement) so a short trigger expands to the notation you want.
On a Chromebook
Press Shift + \, the same as any keyboard. ChromeOS has no Alt codes, so when a key is genuinely missing, use Ctrl + Shift + U, type 7c, then press Enter or Space.
An underlined u appears while you type the code. The symbol picker at Launcher + Shift + Space works too, though for a key already on the keyboard, Shift + \ is quicker.
In Notion, Slack, Discord, and Canva
In all four, type the bar straight from the keyboard with Shift + \. Two behaviours are worth knowing. In Discord, wrapping text in double bars, ||like this||, creates a hidden spoiler, so a stray pair can blur your message.
In Slack and any Markdown editor, the pipe also marks table columns, so it can behave oddly at the start of a line. When in doubt, paste the character and it stays literal.
For HTML and CSS
In page text you can usually type the raw | character. Where you need an entity, use | or the numeric | (decimal) and | (hex).
In CSS content values, escape it as \7c. The pipe carries its own meaning in CSS attribute selectors and in regular expressions, so escape it there when you mean a literal bar.
When the bars look wrong
Split down the middle? A bar with a visible gap is the broken bar ¦ (U+00A6), a different character from the solid vertical line.
Some older fonts and a few keyboard layouts draw the pipe key with that gap even when the character is correct. Switching fonts confirms which one you have.
Looks like a letter? In several fonts the pipe |, lowercase L (l), and capital I sit very close together. The vertical bar runs the full height of the line with no serifs, which is the tell.
Bars too short for a tall fraction? A plain | will not grow. In LaTeX, wrap the expression in \left| and \right|.
In Word or Google Docs, build it inside the equation editor. On UK and some European keyboards, the | key is not above Enter; look for it near the left Shift or beside the Enter key, often paired with \.
What the absolute value bars mean
Absolute value strips the sign from a number: |-5| = 5 and |5| = 5, the distance from zero. The same bars carry other meanings, which is why context matters.
|A| can be the determinant of a matrix, |S| is the number of elements in a set (its cardinality), and in set-builder notation {x | x > 0} the bar reads “such that. “
A double bar, ‖v‖ (U+2016), marks the norm or length of a vector, not absolute value, so the two are not interchangeable. You will find the rest of these notations across the site’s math symbol guides.
Related guides
If you are setting math notation, these cover the symbols people type alongside absolute value:
- Angle symbol (∠): type it on any keyboard, another delimiter you will meet in geometry.
- How to type the power of symbol (xⁿ) fast, for raising a value to an exponent.
- How to type the negative exponents symbol, when the power itself is negative.
- How to type the superscript numbers symbol (¹²³) fast, for small raised digits.
- One half symbol (½): how to type it in Word and Excel, a ready-made fraction glyph.
Frequently asked questions
Is the absolute value symbol the same as the pipe character?
Yes. Both are the vertical line at Unicode U+007C, the character you get from Shift + \.
Math calls it the absolute value bar; programmers call it the pipe. There is no separate absolute value character, so the notation uses one bar on each side of the value.
Why does my vertical bar show up split or broken?
You have either typed the broken bar ¦ (U+00A6, from Alt+0166) or you are using a font that draws the pipe with a gap. Retype it with Shift + \, and if it still looks broken, switch to a font like Arial or Calibri to confirm the character is right.
How do I make the bars stretch around a tall fraction?
A plain | stays one line high. In LaTeX, wrap the expression in \left| and \right| so the bars auto-size. In Word, PowerPoint, or Google Docs, build the absolute value inside the equation editor, which sizes the bars to the contents.
What is the difference between |x| and ‖x‖?
Single bars |x| mean absolute value, the distance of a number from zero. Double bars ‖x‖ (U+2016) mean the norm or magnitude, used for the length of a vector. They are different symbols, so do not swap one for the other in formal math.
Why does typing || in Discord hide part of my message?
Discord reads double vertical bars as spoiler tags, so ||text|| turns text into a blurred spoiler that readers click to reveal. If you meant absolute value, add a space between the bars and the content, or write out abs() instead.
How do I calculate absolute value in Excel rather than just type the symbol?
The bars are only text in a spreadsheet. Use the ABS function: =ABS(-8) returns 8, and =ABS(A1) returns the absolute value of whatever is in A1. Type the | symbol only when you want it shown as a label, not computed.