Non-Breaking Hyphen (U+2011) and Soft Hyphen (U+00AD) Explained
Two special hyphens control what happens at the end of a line. The non-breaking hyphen looks like a normal hyphen but keeps both halves of a word together on one line. The soft hyphen is the reverse: it stays invisible until a line needs to break there. Both are useful in layout, and both cause quiet problems when they are copied into data. This guide covers how to type them and how to find and replace them.
The two characters side by side
| Non-breaking hyphen | Soft hyphen | |
|---|---|---|
| Unicode | U+2011 | U+00AD |
| HTML | ‑ or ‑ | ­ or ­ |
| In a programming string | "‑" | "" |
| Visible? | Always, as a hyphen | Only when a line breaks at that spot |
| Line break | Never allowed after it | Allowed, and a hyphen is then shown |
| Purpose | Keep a hyphenated term in one piece | Suggest where a long word may be divided |
What a non-breaking hyphen is for
A normal hyphen is a legal place to break a line, so software feels free to end a line right after it. Usually that is fine. Sometimes it splits something that reads badly in two pieces:
- phone numbers and product codes, such as 555-0142 or TX-200
- short compounds, such as e-mail, X-ray or T-shirt, where a single letter would be stranded at the end of a line
- hyphenated names
- ranges and dates written with hyphens, such as 2024-05-17
Replacing the hyphen with U+2011 tells the layout engine that the whole term must stay on one line. On screen and in print it looks like an ordinary hyphen.
What a soft hyphen is for
A soft hyphen marks a point inside a word where it may be divided. As long as the word fits on the line, the soft hyphen shows nothing. If the word lands at the end of a line and does not fit, the line breaks at the soft hyphen and a visible hyphen appears there. It is also called an optional or discretionary hyphen.
It is useful for long words in narrow columns, for technical terms that automatic hyphenation gets wrong, and for languages with very long compound words. On web pages it is written ­, and browsers honour it by default.
How to type them
| Where | Non-breaking hyphen | Soft hyphen |
|---|---|---|
| Word on Windows | Ctrl + Shift + - | Ctrl + - |
| Word on Mac | Cmd + Shift + - | Cmd + - |
| Word, by menu | Insert > Symbol > More Symbols, then the Special Characters tab, which lists Nonbreaking Hyphen and Optional Hyphen | |
| Google Docs | Insert > Special characters, then search by name or enter the code, 2011 or 00AD | |
| Windows, other apps | No dependable Alt code; copy it, or pick it in Character Map | Alt + 0173 on the numeric keypad |
| Mac, other apps | Open the Character Viewer with Ctrl + Cmd + Space and search by name | |
| Linux | In many apps, Ctrl + Shift + U, then the code and Enter | |
| HTML | ‑ | ­ |
In Word, both special hyphens are easier to work with when formatting marks are shown. The optional hyphen then appears as a hyphen with a small hook, ¬, even where no line breaks.
On the web there is a second way to keep a hyphenated term together without any special character. Wrap it in an element styled with white-space: nowrap. The text then contains only normal hyphens, which avoids the copy and paste problems described below.
Problems with the non-breaking hyphen
The non-breaking hyphen is a different character from the hyphen on the keyboard. It only looks the same. Once it is copied out of a document, that difference causes trouble:
- Search does not match. Looking for a product code typed with a normal hyphen may not find the same code written with
U+2011. Some programs treat the two as equal when searching and many do not. - Identifiers break. Phone numbers, order numbers, ISBNs, user names and file names pasted from a formatted document stop matching the stored value.
- Commands and formulas fail. A command-line option or a negative number that begins with
U+2011is not recognised, because programs expect the plain hyphen. - Fonts may lack it. Not every font has a shape for
U+2011. The system then borrows the hyphen from another font, or shows an empty box, and the result looks slightly off.
Problems with the soft hyphen
- It travels unseen. Text copied from a web page, an e-book or a PDF can carry soft hyphens inside its long words, with nothing to show for it.
- Words stop matching. A word with a soft hyphen inside is a different string from the plain word. Search, spell checking, sorting and duplicate detection can all be thrown off, although some programs ignore soft hyphens when comparing.
- Counts are too high. Each one counts as a character, so a text can exceed a length limit while looking short enough.
- It can become visible. Software that does not understand the character may print it as a real hyphen in the middle of a word, on every occurrence.
How to find and replace them
Soft hyphens
The AI Text Cleaner removes soft hyphens when Remove invisible characters is switched on, which is the default. They are also shown in the list of characters found as U+00AD, with a count, so you can see whether your text had any.
Non-breaking hyphens
The cleaner does not change the non-breaking hyphen, and it does not include it in the list of characters found. Replace it yourself with one of the methods below.
In Microsoft Word
Open Find and Replace. The code ^~ finds a nonbreaking hyphen and ^- finds an optional hyphen. Put a normal hyphen in the Replace box for the first, and leave the box empty for the second.
In a spreadsheet
=SUBSTITUTE(SUBSTITUTE(A1, UNICHAR(8209), "-"), UNICHAR(173), "")
The inner part turns each non-breaking hyphen into a normal one, and the outer part deletes soft hyphens.
In Python
clean = text.replace("‑", "-").replace("", "")
In a code editor
Switch on regular expressions in find and replace and search for ‑ or . Visual Studio Code accepts both patterns.
Other hyphen look-alikes
The non-breaking hyphen is one of several characters that can pass for the keyboard hyphen. If a hyphenated value refuses to match, one of these may be the reason:
| Code | Name |
|---|---|
U+002D | Hyphen-minus, the keyboard key |
U+2010 | Hyphen |
U+2011 | Non-breaking hyphen |
U+2012 | Figure dash |
U+2013 | En dash |
U+2212 | Minus sign |
U+FF0D | Fullwidth hyphen-minus |
The differences between the hyphen and the dashes are explained in em dash vs en dash vs hyphen.
When to keep them
In a document that you lay out for reading, such as a report, a book or a web page, both characters are doing their job and should stay. Replace them when the text is headed somewhere that compares or parses characters: a database, a spreadsheet, a form, a file name, source code or a search box. The same advice applies to the non-breaking space, which is the hyphen's counterpart for gaps between words.
Quick answers
What is the difference between a non-breaking hyphen and a soft hyphen? A non-breaking hyphen is always visible and never lets a line break after it. A soft hyphen is invisible and shows up only when a line breaks at its position.
How do I type a non-breaking hyphen in Word? Press Ctrl plus Shift plus the hyphen key on Windows, or Cmd plus Shift plus the hyphen key on a Mac.
Why does my search not find a word that has a hyphen in it? The hyphen in the text may be a different character, such as a non-breaking hyphen or an en dash, or the word may contain an invisible soft hyphen.