What is a soft hyphen?
A soft hyphen is U+00AD, an invisible character that says "you may break the word here." If the line has room, nothing shows. If the word would overflow, the layout engine breaks the line at the soft hyphen and draws a hyphen at the end of the first line. The character is still inside the word in the underlying text either way.
| Character | Code point | Visible? | Allows a line break? |
|---|---|---|---|
| Hyphen-minus | U+002D | Always | Yes, after it |
| Soft hyphen | U+00AD | Only at a line break | Yes, at that point |
| Non-breaking hyphen | U+2011 | Always | No |
Where do soft hyphens come from?
- Web pages that use ­ or CSS/JS hyphenation helpers to control wrapping in narrow columns.
- Word documents where someone pressed Ctrl+minus to insert an optional hyphen, or that were hyphenated automatically before being copied.
- PDFs and ebooks. Text copied from justified, hyphenated layouts can bring the line-end hyphen or a soft hyphen along. See cleaning text copied from a PDF for what is and isn't recoverable.
What does it break?
Anything that treats the word as a sequence of characters: Ctrl+F searches, spell-checkers that flag a correctly spelled word, keyword counts, string equality in code, database lookups and URLs. Because it is invisible, the text gives no clue. The same failure pattern applies to the zero-width space and other members of the invisible characters family.
How to remove soft hyphens
Paste the text into the cleaner above. It deletes each U+00AD and lists the count in the report so you can confirm the change. Do it yourself with these:
| Where | How |
|---|---|
| JavaScript | text.replace(/\u00AD/g, "") |
| Python | text.replace("\u00AD", "") |
| Excel | =SUBSTITUTE(A1, UNICHAR(173), "") |
More patterns for every invisible character are in the regex guide.
When should I keep soft hyphens?
Keep them in HTML or Word source you are still going to publish, where they do their job of improving line breaks. Remove them from anything that becomes data: search indexes, spreadsheets, code, slugs, or text you are comparing. Do not replace a soft hyphen with a visible hyphen unless you have checked that the word really was split.