Typing code snippets, phone numbers, command-line arguments, or technical specifications in Microsoft Word only to watch two consecutive hyphens (--) automatically snap together into a single elongated en dash (–) or em dash (—) can be deeply annoying. While typographic dashes look elegant in literary fiction and journalism, they break programming syntax and corrupt technical documentation. Word performs this automatic conversion behind the scenes as part of its AutoFormat engine. Fortunately, disabling this automated replacement takes only a moment in Word’s proofing options.
Disable Automatic Hyphen Replacement via AutoFormat Options
Word manages the conversion of consecutive hyphens through its “AutoFormat As You Type” settings. Turning off this toggle stops Word from altering your typed punctuation globally.
- Open Microsoft Word on your computer.
- Click File in the upper-left corner and select Options at the bottom of the left-hand navigation pane.
- In the Word Options dialogue, click the Proofing tab on the left.
- Click the button labelled AutoCorrect Options….
- In the secondary dialogue box, switch to the AutoFormat As You Type tab.
- Under the header Replace as you type, locate the checkbox labelled Hyphens (–) with dash (—).
- Untick the box beside Hyphens (–) with dash (—).
- Click the AutoFormat tab (the adjacent tab) and ensure the same checkbox is unticked there as well.
- Click OK twice to save your preferences.
Word will now preserve raw double hyphens exactly as typed without converting them into typographical symbols.
Use the Instant Undo Shortcut for Single Overrides
If you generally appreciate automated dashes in prose but need to retain raw hyphens for a single parameter or code block, use the immediate undo shortcut.
- Type your word, followed by two hyphens, the next word, and a space (e.g.
pre--release). - The instant Word merges the two hyphens into an elongated dash, press Ctrl + Z (or Command + Z on Mac).
- Word will reverse the automatic replacement and restore your original two hyphens whilst leaving your cursor position intact.
- Continue typing normally; Word will not attempt to convert those specific hyphens again.
Tapping Ctrl + Z once after the automatic format triggers acts as an immediate local override without altering permanent settings.
Check for Custom AutoCorrect Entry Replacements
Sometimes users or third-party templates add an explicit rule in the plain AutoCorrect table that replaces hyphens with symbols.
- Navigate back to File > Options > Proofing > AutoCorrect Options….
- Select the primary AutoCorrect tab.
- In the Replace box on the left, type
--. - If an active entry appears matching two hyphens with a dash in the list below, select it and click Delete.
- Click OK to exit.
Removing manual AutoCorrect entries guarantees that punctuation typing remains untouched.
Best Practices for Writing Code and Command Flags in Word
If you regularly draft software instructions in Word, formatting text as code prevents various typographical auto-corrections from interfering.
- Highlight command-line text containing double hyphens (such as
--helpor--config). - Apply a monospace font like Consolas or Courier New.
- Under Review > Language > Set Proofing Language, tick Do not check spelling or grammar to prevent syntax flagging.
Treating technical text as code blocks maintains exact syntax integrity across business reports.