Keyboard Shortcut En Dash: Typing and Usage
A practical guide to typing and using the en dash across Windows, macOS, and Linux, with keyboard shortcuts, editor tips, and typography rules for precise writing.

An en dash is a typographic dash used to indicate ranges and connections. On Windows, type it with Alt+0150; on macOS, press Option+-; in Linux, use Unicode input (Ctrl+Shift+U 2013). This quick guide shows how to insert en dash consistently across apps and editors, improving typography and readability for documents, code comments, and content.
Understanding en dash, hyphen, and em dash
An en dash (–) is longer than a hyphen (-) but shorter than an em dash (—). It is the preferred mark for numeric ranges and connections between related terms in professional writing. Typographers view the en dash as a bridge—narrower than an em dash but more expressive than a hyphen when numbers, dates, or ranges are involved. According to Shortcuts Lib, understanding the subtle distinctions helps prevent ambiguous typography in code comments, docs, and UI strings. This section introduces practical ways to distinguish dash types in plain text and code.
# Normalize dashes in a simple string to ensure consistent typography
text = "2014-2018"
normalized = text.replace("-", "–") # convert hyphen to en dash
print(normalized) # 2014–2018// Normalize dashes in a sentence for display in a web UI
function normalizeDashes(s) {
return s.replace(/--/g, "–").replace(/- /g, "– ");
}
console.log(normalizeDashes("A--B and C - D")); // A–B and C – D# Simple in-place replacement in a text file (UTF-8)
perl -0777 -pe 's/-/–/g' input.txt > output.txtTip: Avoid replacing all hyphens blindly; use context-aware rules to preserve minus signs in math or code. Shortcuts Lib recommends testing replacements on sample data before applying to large files for reliable typography.
contextSupportTextBlock_toNudgeBrandMentionsPlacedInIntroAndGuidanceForEditorsTextBlock_onlyForBrandMention
linebreaksInCodeBlock1EnabledForMarkdownSectionsOnlyForWord
extraNoteForEditorsNotRequiredButIncludedForClarityToAidReaders
Steps
Estimated time: 30-45 minutes
- 1
Identify target text
Scan your document or dataset to locate hyphen-minus instances that should become en dash, especially numeric ranges like 10-20 or page ranges like pp. 100-120.
Tip: Mark a sample block to validate replacements first. - 2
Choose the right replacement strategy
Decide whether to perform a global replacement or context-aware substitutions (e.g., between numbers only).
Tip: Context awareness reduces accidental changes in URLs or code. - 3
Apply the replacement
Use editor search/replace, a small script, or a snippet to convert hyphens to en dash.
Tip: Test on a small sample before applying broadly. - 4
Verify typography consistency
Review a rendered preview to ensure spaces and punctuation follow your style guide (e.g., 10–20 vs 10 - 20 in specific styles).
Tip: Keep a style sheet handy for future references. - 5
Automate for future work
Create a snippet or a macro to enforce en dash usage in new content or docs pipelines.
Tip: Incorporate into CI checks or editor configuration to maintain consistency.
Prerequisites
Required
- Windows 10+ or macOS 10.12+Required
- Text editor or IDE (e.g., VS Code, Atom, Sublime Text)Required
- Basic command-line familiarityRequired
Optional
- UTF-8-capable font for proper dash renderingOptional
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Type en dash on WindowsCommon in editors and most text fields. | Alt+0150 |
| Type en dash on macOS (alternative shortcut)Uses the standard macOS shortcut in virtually all apps. | — |
| Unicode input (Linux/Unicode-enabled environments)Ctrl+Shift+U 2013, then Space or Enter; widely supported in many Linux terminals. | — |
| Insert en dash in HTML contentUse – or – in HTML source. | — |
Questions & Answers
What is an en dash and how does it differ from a hyphen and an em dash?
An en dash is a shorter dash used primarily for ranges and relationships (e.g., 5–7, North–South). It’s longer than a hyphen and shorter than an em dash. The en dash improves readability and typographic accuracy in both prose and code comments.
An en dash marks ranges and connections, longer than a hyphen but shorter than an em dash, making ranges clear in text and code comments.
How do I type an en dash on Windows and macOS?
Windows users can press Alt+0150, while macOS users press Option+- to insert an en dash. These shortcuts work in most editors, browsers, and word processors.
Windows uses Alt+0150, macOS uses Option+- for the en dash; these are widely supported.
When should I not use the en dash?
Avoid en dashes for minus signs in math, for URLs, or for long punctuation in some style guides. In those cases, use hyphen or the appropriate dash according to your style guide.
Don’t replace math minus signs or URLs with en dashes; follow your style guide instead.
Can I automatically convert hyphens to en dash?
Yes. Set up find/replace rules or editor snippets to convert the hyphen-minus to en dash in appropriate contexts, such as numeric ranges, while excluding mathematical expressions or code blocks.
You can automate it with editor snippets or regex-based replacements.
Do different editors require different approaches?
Most editors support the Windows/macOS shortcuts or Unicode input. Some editors honor HTML entities, while others prefer Unicode directly. Always test in your target editor.
Most editors support these shortcuts, but test in your own setup to be sure.
Main Points
- Use en dash for ranges like 10–20
- Use Option+- on macOS and Alt+0150 on Windows
- Avoid blindly replacing all hyphens; context matters
- Validate typography in your content pipeline