How to insert an em dash
Type an em dash (—) on Windows, Mac, Linux, phones, Word, Google Docs, HTML and code, convert double hyphens safely, and confirm you got U+2014.
An em dash (—) is a long dash used to set off an aside, mark an abrupt break, or introduce an explanation. Most keyboards have no dedicated key for it, so you produce it with a shortcut, a character picker, an automatic substitution, or an escape code. This guide covers each method and shows how to confirm you inserted a true em dash rather than a hyphen or en dash that looks similar.
What an em dash is and what inserting one changes
Inserting an em dash places a single Unicode character, U+2014 EM DASH, into your text. It is different from three similar characters, and they are not interchangeable. Software that searches, sorts, or validates text treats each one as a distinct character.
| Character | Name | Unicode code point | Typical use |
| • | Hyphen-minus | U+002D | Compound words, line-break hyphenation, command-line options |
| – | En dash | U+2013 | Ranges such as 10–20 or pages 4–9 |
| — | Em dash | U+2014 | Breaks, asides, and emphasis in a sentence |
| − | Minus sign | U+2212 | Mathematical subtraction and negative numbers |
In UTF-8, the encoding used by most web pages and modern text files, an em dash is stored as three bytes: E2 80 94. In the older Windows-1252 encoding it is the single byte 0x97. If a file is saved in one encoding and opened as another, the dash can turn into garbled characters, so keep your text in UTF-8 when you can.
Spacing is a style choice, not part of the character. Many US style guides, including the Chicago Manual of Style, set the em dash closed with no spaces (word—word), while AP style puts a space on each side (word — word). Choose one convention and apply it consistently.
Keyboard shortcuts by operating system
Windows
- Alt code: turn on Num Lock, hold Alt, type 0151 on the numeric keypad, then release Alt. The number keys above the letters do not work for this method.
- Emoji and symbol panel: press Windows key + period (.), open the Symbols section, and choose the em dash from the punctuation list.
- Character Map: open Character Map, find the em dash, select it, copy it, and paste it into your document. This works on laptops without a numeric keypad.
macOS
- Em dash: Option + Shift + Hyphen.
- En dash, for comparison: Option + Hyphen.
- Character Viewer: press Control + Command + Space and search for "em dash".
Linux
- Unicode entry in many GTK applications that use IBus: press Ctrl + Shift + U, type 2014, then press Space or Enter.
- Compose key, if one is configured: press Compose, then hyphen three times (Compose - - -).
- Character picker: desktop environments such as GNOME include a Characters app where you can search for "em dash" and copy it.
iPhone, iPad and Android
On the iOS keyboard and on Gboard, switch to the numbers and symbols layout, then press and hold the hyphen key. A small menu appears with the en dash and the em dash. Slide to the longest dash and release. Other Android keyboards may place it elsewhere, so check their symbol pages if long-pressing does nothing.
Word processors
Microsoft Word
- Shortcut: Ctrl + Alt + the minus key on the numeric keypad.
- AutoFormat: type a word, two hyphens, and another word with no spaces (for example word--word), then keep typing. Word replaces the hyphens with an em dash when the "Hyphens (--) with dash (—)" AutoFormat As You Type option is on.
- Menu: Insert > Symbol > More Symbols > Special Characters > Em Dash.
With spaces around the hyphens (word -- word), Word's AutoFormat produces an en dash instead. If you want spaced em dashes, use the shortcut or the Symbol dialog.
Google Docs
Choose Insert > Special characters and type "em dash" into the search box, then click the result. For repeated use, open Tools > Preferences > Substitutions and add a rule that replaces a sequence you choose, such as three hyphens, with an em dash you have pasted into the replacement field. Automatic dash substitution behavior in Docs has changed over time, so test it in your own document before relying on it.
Web pages, markup and code
When you write HTML, you can type the character directly if the page is served as UTF-8, or use any of these entity forms, which browsers render identically:
—
—
—
Other common escapes, shown here as examples of the syntax in each language:
CSS (in a content property): content: "\2014";
JavaScript string: "\u2014"
Python 3 string: "\u2014" or "\N{EM DASH}"
LaTeX text: word---word
Some Markdown processors with a "smart punctuation" or SmartyPants option turn three hyphens into an em dash on output. Whether this happens depends on the processor and its settings, so check your rendered output instead of assuming the conversion occurred.
Converting double hyphens to em dashes across a document
If a draft uses -- as a stand-in for an em dash, a find-and-replace can convert them all at once. This operation overwrites text, so make a copy of the file first. Also scope the pattern carefully: a blanket replacement of -- will damage command-line options such as --verbose, code samples, separator lines, and comment markers like -- in SQL.
In Microsoft Word
- Save a copy of the document.
- Open Replace (Ctrl + H).
- In Find what, enter --.
- In Replace with, enter ^+ (Word's code for an em dash; ^= is the code for an en dash).
- Use Find Next and Replace one at a time if the document contains code or technical text; use Replace All only when every match should change.
On the command line
The following Perl command is an illustrative example. It replaces two hyphens only when they sit between two word characters, which avoids option names that start a token (such as --verbose). It reads and writes UTF-8 and edits the file in place while keeping a backup with a .bak extension.
perl -CSD -i.bak -pe 's/(?<=\w)--(?=\w)/\x{2014}/g' draft.txt
Example input and the output this pattern is designed to produce (illustrative, not a recorded test):
Before:
The result--as expected--was clear.
Run the tool with --verbose for details.
After:
The result—as expected—was clear.
Run the tool with --verbose for details.
Adjust the pattern to your style. If your draft uses spaced double hyphens (word -- word) and you want closed em dashes, match the spaces as well, for example s/ -- /\x{2014}/g. Note that the lookbehind version above would still change a hyphenated token like foo--bar inside code, so review the diff before keeping the result. If you prefer sed, make sure your shell and locale use UTF-8; otherwise a literal — in the replacement may be written as unexpected bytes.
Newline style does not affect this replacement, because the pattern never spans a line break. A dash split across two lines (one hyphen at the end of a line, one at the start of the next) will not be matched and needs a manual fix.
Recovering if the replacement went wrong
Restore from the copy you made: in Word, reopen the saved original or use Undo immediately after Replace All; on the command line, rename draft.txt.bak back to draft.txt. To review changes before discarding the backup, compare the two files with a diff tool such as diff draft.txt.bak draft.txt.
Checking that you inserted a real em dash
An en dash and an em dash can look nearly identical in some fonts, and a hyphen can pass for a dash in a monospace editor. Check the actual character rather than trusting its appearance.
- In Word on Windows: place the cursor right after the character and press Alt + X. Word replaces it with its code point; 2014 means em dash. Press Alt + X again to switch it back.
- In Python: print(hex(ord("—"))) prints 0x2014 for an em dash and 0x2013 for an en dash.
- In a terminal: pipe the text through a hex viewer such as xxd or od -An -tx1. An em dash in a UTF-8 file appears as e2 80 94.
- To find every em dash in a file: grep -nP '\x{2014}' draft.txt, run in a UTF-8 locale with a grep that supports -P.
- To find leftover double hyphens you may have missed: grep -n -- '--' draft.txt. The first -- tells grep that options have ended, so the pattern is not mistaken for one.
If the hex output shows the single byte 97 instead of e2 80 94, the file is in Windows-1252 rather than UTF-8. If you see characters such as — where the dash should be, UTF-8 bytes were decoded as Windows-1252; reopen or convert the file with the correct encoding instead of retyping the dashes.
Gaps in this guide
Shortcuts and menu paths above reflect commonly documented defaults. Keyboard layouts, input-method settings, app versions, and custom remapping can change them, and no version-specific testing results were available for this guide. If a shortcut does nothing, fall back to your system's character picker, which works across apps.