How to Type a Hyphen on a Keyboard

Find the hyphen key on Windows, Mac, mobile and Linux keyboards, type en and em dashes when needed, and check that you entered the character you intended.

Most keyboards have a dedicated hyphen key, so typing a hyphen usually takes a single keystroke. The harder parts are telling the hyphen apart from its look-alikes (en dash, em dash, minus sign) and stopping software from silently swapping one for another. This guide covers both.

What the hyphen key actually types

The hyphen key produces a character called the hyphen-minus, Unicode code point U+002D. A code point is the number that identifies a character in the Unicode standard. The hyphen-minus is used to join words (well-known), split words across lines, write ranges in casual text, and act as a minus sign in code and plain-text math. Typography has separate, more specific characters for some of these jobs. They look similar but are different characters, which matters for search, sorting, find-and-replace and code.

Character | Name | Code point | Typical use
• | Hyphen-minus (the key on your keyboard) | U+002D | Compound words, code, command-line options
‐ | Hyphen | U+2010 | Typographic hyphen; rarely needed
‑ | Non-breaking hyphen | U+2011 | Keeps hyphenated words on one line
(invisible) | Soft hyphen | U+00AD | Marks where a word may break; shows only at a line break
– | En dash | U+2013 | Ranges such as 9–5 or pages 10–12
— | Em dash | U+2014 | Breaks in a sentence—like this
− | Minus sign | U+2212 | Typeset mathematics

Where the hyphen key is on a standard US keyboard

  • Look at the top row of number keys.
  • Find the 0 key. The hyphen key is directly to its right, and the = key is to the right of that.
  • Press it without Shift to type a hyphen (-). With Shift, the same key types an underscore (_).
  • On a full-size keyboard, the minus key on the numeric keypad (top right of the keypad) types the same hyphen-minus character.

On non-US layouts the hyphen may sit in a different spot. The printed key legends for your layout, or your operating system's on-screen keyboard view, show where it is.

Typing a hyphen on a Mac

On a Mac with a US layout, the hyphen key is in the same place: right of 0. Press it to type a hyphen. The same key also produces the two common dashes:

  • Hyphen (-): press the hyphen key.
  • En dash (–): Option + hyphen.
  • Em dash (—): Option + Shift + hyphen.

Typing hyphens and dashes on Windows

Press the hyphen key, or the minus key on the numeric keypad, to type a hyphen. Windows has no single-key shortcut for dashes, but Alt codes work in many applications: hold Alt and type the number on the numeric keypad (not the top-row numbers), then release Alt.

  • En dash (–): Alt + 0150
  • Em dash (—): Alt + 0151

In Microsoft Word you can also type a hexadecimal code point and then press Alt + X to convert it into the character. For example, type 2011 and press Alt + X to get a non-breaking hyphen. Pressing Alt + X right after a character reverses the process and shows its code, which is useful for checking your work (see below).

Typing a hyphen on phones and tablets

On iPhone, iPad and common Android keyboards, the hyphen is on the numbers-and-symbols screen. Tap the key that switches to numbers (often labeled 123 or ?123) and tap the hyphen. On many mobile keyboards, pressing and holding the hyphen shows a pop-up with the en dash and em dash. The exact set of options depends on the keyboard app.

Typing special hyphens on Linux

The hyphen key itself works as on any other keyboard. For other hyphen and dash characters, many GTK-based applications and IBus input setups let you press Ctrl + Shift + U, type the hexadecimal code point, and press Enter or Space. For example, Ctrl + Shift + U, then 2013, then Enter types an en dash. Support depends on your desktop environment and input method, so try it in the application you plan to use.

Non-breaking and optional hyphens in Word

A regular hyphen lets a line break after it, so a phone number or a compound name can end up split across two lines. Word provides two shortcuts for controlling this:

  • Non-breaking hyphen: Ctrl + Shift + hyphen. Displays as a hyphen but keeps both sides on the same line.
  • Optional hyphen: Ctrl + hyphen. Invisible unless the word falls at the end of a line, where it becomes a break point with a visible hyphen. In Unicode terms this behaves like the soft hyphen (U+00AD).

Both characters can cause trouble if the text is later pasted into a web form, spreadsheet or code editor. A search for a regular hyphen won't find a non-breaking one, and a soft hyphen can hide inside a word and break exact-match searches.

Stopping automatic dash replacement

Some software converts hyphens to dashes as you type. In Word, AutoFormat can replace two hyphens between words with an em dash, or a spaced hyphen with an en dash. macOS and iOS have a setting that substitutes smart quotes and dashes. That helps in prose but hurts in code, command-line options, file names and product codes, where the plain hyphen-minus is required.

  • Word: open File > Options > Proofing > AutoCorrect Options, go to the AutoFormat As You Type tab, and clear the option that replaces hyphens with dashes. Press Ctrl + Z immediately after an unwanted conversion to undo just that change.
  • macOS: in the keyboard text input settings, turn off the option for smart quotes and dashes. Some apps also have a setting under Edit > Substitutions.
  • iPhone and iPad: turn off Smart Punctuation in the keyboard settings.

Illustrative example of an unwanted conversion (not tested output; the result depends on your application and settings):

Typed:          ls --all
After AutoFormat: ls —all

The second line no longer works as a command, because the two hyphen-minus characters (U+002D U+002D) became one em dash (U+2014). To fix text that has already been converted, use find and replace: search for the dash character, replace it with the intended hyphens, and review each match instead of replacing all at once, because some dashes in the document may be correct.

Checking which character you typed

Because the hyphen, non-breaking hyphen, en dash and minus sign can look almost identical, confirm by code point rather than by eye:

  • In Word, place the cursor right after the character and press Alt + X. A plain hyphen shows as 2d (or 002D). Press Alt + X again to restore the character.
  • In a code editor or text tool that displays Unicode code points, select the character and read its value.
  • If you have Python available, paste the character into a short script like the one below.
for ch in "-–—":
    print(repr(ch), f"U+{ord(ch):04X}")

If the string contains a hyphen-minus, an en dash and an em dash, in that order, the script prints U+002D, U+2013 and U+2014 on separate lines. This is an illustrative example showing the expected output, not a captured run. If you see U+002D for the character you meant as a hyphen, you typed the standard keyboard hyphen.

Limits of this guide

The shortcuts above are common defaults for US keyboard layouts. Menu names and settings locations change between operating system and application versions, and some third-party keyboards or remapping tools override them. No version-specific testing data was available for this article, so if a shortcut doesn't respond, check your current layout and the application's own keyboard-shortcut documentation.