Soft Hyphens Explained: Better Justified Text on the Web and in Ebooks
Why justified text gets gaps, how soft hyphens and TeX hyphenation patterns fix them, and when to use ­, CSS hyphens or fixed-width line breaks.

Justified text looks tidy in a printed book but often ugly on a phone. When a column is narrow and long words cannot break, the line has to stretch the spaces between the remaining words, and the page fills with gaps and rivers of white space. Typesetters solved this long ago with hyphenation. On the web and in ebooks, the simplest reliable fix is the soft hyphen.
What a soft hyphen does
A soft hyphen is an invisible character, U+00AD in Unicode and ­ in HTML. It marks a place where a word may break. If the word fits on the line, nothing shows. If it falls at the end of a line, the browser or reader breaks it there and draws a hyphen. Put soft hyphens in all the long words of a paragraph and the layout engine suddenly has many more ways to fill each line evenly.
Where the break points come from
Placing soft hyphens by hand is slow and error-prone, and English hyphenation is far from obvious. In 1983 Franklin Liang described an algorithm for TeX that learns short letter patterns from a hyphenated dictionary and uses them to score the gaps between letters. It finds the large majority of correct break points with very few wrong ones, and pattern files now exist for dozens of languages.
The Hyphenation and Line Break Tool applies those TeX patterns, through the open-source hyphen library, to any text you paste. Choose one of 37 languages, load its pattern file once and the tool inserts soft hyphens throughout. You can set the minimum number of letters before and after a break, the shortest word to hyphenate, and whether to skip names, URLs and e-mail addresses.
Check the result
The preview shows your paragraph twice in a narrow justified column, without and with soft hyphens, at the width and font size you choose. The difference is usually obvious at once. Switch to the visible view to proofread: every break point is shown with a hyphen or a dot. Patterns do not understand meaning, so check names, product terms and compound words. Add any word that breaks badly to the exception list, written with your own hyphens, or with none to keep it whole.
Soft hyphens or CSS hyphens: auto?
Modern browsers can hyphenate by themselves with the CSS property hyphens: auto, as long as the element has the right lang attribute. That is a good choice for many websites. Soft hyphens are better when you need the same result everywhere: in ebook readers with limited hyphenation support, in HTML e-mails, in older browsers, in languages a browser does not support, or in design programs and word processors that receive your text. The tool gives you a CSS snippet for both approaches.
Getting the output into your work
For Word, InDesign, Google Docs and most content management systems, copy the text with Unicode soft hyphens. For HTML source code, copy the ­ version, which is easier to see and edit. If your input is HTML, switch on HTML mode so tags, entities and code blocks stay untouched while only the visible text gets hyphenated.
For plain text, such as a README, a monospace layout or a label printer, the wrap option breaks lines at a fixed number of characters and uses the hyphenation points to fill lines evenly, inserting real hyphens at the line ends.
A few cautions
Keep an unhyphenated copy of your source, because soft hyphens can interfere with search in some programs and with copying text into forms. Avoid hyphenating headings and very short lines. And remember that hyphenation is a finishing step: do it after the text is final, not before the next round of edits.
Used with care, soft hyphens make narrow justified text look calm and even, the way it does in a well-set book.


%20Generator&c=%23991b1b&k=documents)
