Hyphenation and Line Break Tool

Justified text in narrow columns, ebooks and mobile layouts leaves wide gaps between words unless long words can break. This tool inserts invisible soft hyphens at the correct break points using the same Liang patterns as TeX, for 37 languages, and lets you compare a narrow justified column with and without them. Copy the result as Unicode soft hyphens, HTML ­ entities, visible hyphens, text wrapped to a fixed width or CSS.

S'exécute dans votre navigateur. Vos fichiers ne quittent jamais votre appareil. Voir comment vérifier

…

Comment faire

  1. 1
    Choose the language

    Pick the pattern language and load it; the download size is shown first.

  2. 2
    Add your text

    Paste text or HTML, or open a .txt, .md or .html file, and turn on HTML mode for markup.

  3. 3
    Set the rules

    Choose the minimum letters before and after a break and the shortest word.

  4. 4
    Add exceptions

    List words with your own hyphens, or without hyphens to keep them whole.

  5. 5
    Preview

    Compare the justified column with and without soft hyphens at your width and font size.

  6. 6
    Copy the output

    Copy Unicode soft hyphens, ­ HTML, visible hyphens, wrapped text or CSS.

À propos de cet outil

A soft hyphen (Unicode U+00AD, written ­ in HTML) is an invisible character that marks a place where a word may break. Browsers, word processors, ebook readers and design programs show nothing there unless the word falls at the end of a line, where they break it and show a hyphen. Adding soft hyphens by hand is slow, so most typesetting systems use Franklin Liang's hyphenation algorithm from 1983, the method built into TeX: a list of short letter patterns learned from a hyphenated dictionary scores the gaps between letters and allows a break where the score is odd. This tool runs that algorithm with the pattern files of the TeX hyph-utf8 collection as packaged in the open-source hyphen library (version 1.14.1, ISC licence). Patterns are loaded from jsDelivr the first time you use a language and the size is shown before you load them: from about 2 KB for Basque to about 100 KB for US English and 1.2 MB for Hungarian. After that, everything runs in this page. You control the minimum letters before and after a break (TeX uses 2 and 3 for English), the shortest word to hyphenate, and whether to skip capitalised words such as names, URLs and e-mail addresses. Words in capitals and words with digits are never broken. An exception list fixes words the patterns get wrong or protects brand names: write the word with your own hyphens (ta-ble) or without any to forbid breaks.

HTML mode

Switch on HTML input to hyphenate a page or a CMS article: tags, attributes, entities, comments and the contents of pre, code, script, style and textarea are left exactly as they are, and only the visible text gets soft hyphens.

Preview

The preview shows the same text twice in a justified column of the width and font size you choose, once without hyphenation and once with the soft hyphens, so you can see the rivers of white space disappear. The counter shows how many soft hyphens were added and how many words can break.

Outputs

Copy or save the text with Unicode soft hyphens for Word, InDesign, Google Docs, ebooks and most CMSs; with ­ entities for HTML source; with visible marks (hyphen, middle dot, bar or the hyphenation point) for proofreading; wrapped to a fixed number of characters with real hyphens at line ends for plain text, monospace layouts, labels or SMS; or a CSS snippet with hyphens: manual and the alternative hyphens: auto.

Limits

Pattern hyphenation finds most correct break points but not all, and it does not know meaning: compounds, names, technical terms and words with two pronunciations can be split in the wrong place, so proofread and add exceptions. Languages without patterns in the package, including Bengali, Hindi, Arabic, Chinese and Japanese, are not supported here. Soft hyphens can disturb search in some programs and screen readers in rare cases; keep an unhyphenated copy of the source.

Exemple concret

An ebook designer pastes a 37-word paragraph and loads the UK English patterns, about 164 KB. With the defaults (2 letters before, 3 after, words of 6 letters or more) the tool adds 40 soft hyphens to 20 of the words; in the visible view hyphenation becomes hy-phen-a-tion, typesetting becomes Type-set-ting and internationally becomes in-ter-na-tion-ally, while short words such as ebook and rivers stay whole. In a 220-pixel justified column at 16 pixels, the version without hyphens has wide gaps on several lines, while the hyphenated version keeps even spacing. She adds shobfree as an exception so the brand name never breaks, copies the ­ HTML for the EPUB chapter and saves a version wrapped at 40 characters for a plain-text edition.

L'essentiel

Questions fréquentes

What is a soft hyphen?

An invisible Unicode character, U+00AD, that marks an allowed break point inside a word. It only appears as a hyphen when the word actually breaks at the end of a line. In HTML it is written as ­.

Which hyphenation patterns are used?

Liang's TeX patterns from the hyph-utf8 collection, as packaged in the hyphen library 1.14.1 under the ISC licence. Each language file keeps the free licence of its original authors. They are the same patterns used by LaTeX and many typesetting programs.

Why not just use CSS hyphens: auto?

Browser hyphenation depends on the browser, operating system and the lang attribute, and some combinations do not support every language. Soft hyphens give the same breaks everywhere and also work in ebooks, emails and design programs.

Can I hyphenate HTML without breaking the markup?

Yes. Turn on the HTML option. Tags, attributes, entities and code or preformatted blocks are skipped, and only the text between tags gets soft hyphens.

What do the minimum letter settings mean?

They stop breaks too close to the start or end of a word. With 2 and 3, the first line keeps at least two letters and the next line at least three, which avoids awkward fragments such as a- or -ly.

Is my text sent to a server?

No. Only the pattern file for the language you choose is downloaded from jsDelivr. The hyphenation, preview and outputs all run in this browser tab.

Entièrement gratuitAucun coût, aucune inscription
Fichiers privésTout s'exécute dans votre navigateur
Simple dans votre langueDisponible en de nombreuses langues