How to type Underscore
_ is Shift + -, in the same place on US and UK keyboards. Alt + 95 on the numeric keypad produces it on any Windows layout, which is the way in when the keyboard in front of you has no key for it, and _ writes it in HTML. Its codepoint is U+005F.
Low Line
- Copy it
- Unicode
- U+005F
- Windows
- Alt + 95
| Where | Shortcut | How |
|---|---|---|
| Windows | Alt + 95 | Hold Alt and type the number on the numeric keypad. |
| HTML | _ | Paste this into HTML source. |
| Unicode | U+005F | LOW LINE |
Other punctuation symbols
_ lives in the Basic Latin block (U+0000-U+007F), the original ASCII set: the letters, digits and punctuation printed on a US keyboard. Within Unicode it is classified as Pc, a connector punctuation mark. It joins words, like the underscore.
What Underscore is used for
_ belongs in prose rather than in an equation. LaTeX writes it \_, a text command, and there is no maths command for it at all: it is a sign that gets written down, not an operator that acts on anything. Putting it inside $...$ is how it comes out looking wrong.
Unicode publishes a second list of names for _ in CLDR, the keywords its own search data offers rather than the formal name, and they are low line, dash, underdash and underline. Those words are what somebody looking for this character is liable to type when Underscore is not the name they know it by, and the search on the symbol lists matches them as well as the Unicode name.
What Unicode says about Underscore
The standard recognises _ under another name as well: spacing underscore (1.0). That is a formal alias, not a nickname, which is why it turns up in other people's documentation for the same codepoint.
Unicode annotates _ directly. Against U+005F the code chart carries the note “This is a spacing character”. It adds: joins with adjacent instances of itself. That is the standard saying what the character is for, rather than an inference from its name.
The code chart points from _ to modifier letter low macron (U+02CD), combining macron below (U+0331), combining low line (U+0332), double low line (U+2017) and combining conjoining macron below (U+FE2D). These are the characters the standard thinks you might have meant instead, which makes them the ones worth checking when Underscore looks nearly right but not quite.
How Underscore behaves in software
_ takes one column in a terminal. It carries no direction of its own, so in a line that mixes English with Arabic or Hebrew it takes the direction of the text around it rather than forcing one.
Every way to write Underscore
| Form | Value |
|---|---|
| Codepoint | U+005F |
| Decimal | 95 |
| UTF-8 bytes | 5F |
| UTF-16 bytes | 00 5F |
| HTML entity | _ |
| HTML numeric | _ or _ |
| CSS | \005F |
| JavaScript | \u005F |
| Python | \u005F |
| URL-encoded | %5F |
| LaTeX, in prose | \_ |
| SVG | 005F.svg · (SIL Open Font License) |
If _ needs escaping
_ is one byte in ASCII, in UTF-8 and in every code page in common use, so it never arrives corrupted. Its problem is the opposite one: it means something to the software reading it. In HTML it can be written _, in a URL it is %5F, and inside a CSV field, a shell command or a regular expression it has to be quoted or escaped rather than typed plainly. That is also why _ is the character people substitute when the one they wanted will not type.