CSS hyphens Property

The CSS hyphens property controls whether words can be divided across lines using manual or automatic hyphenation.

Hyphenation can improve text wrapping in narrow columns by allowing long words to break at appropriate positions. The property supports three main values: none, manual, and auto. Automatic hyphenation depends on the text's language and the browser's available hyphenation resources.

hyphens Syntax

The hyphens property accepts one keyword that determines how words may be divided at hyphenation opportunities.

Basic Syntax

selector {
  hyphens: manual;
}

Disable Hyphenation

p {
  hyphens: none;
}

Manual Hyphenation

p {
  hyphens: manual;
}

Automatic Hyphenation

p {
  hyphens: auto;
}

CSS-Wide Keywords

p {
  hyphens: initial;
}
p {
  hyphens: inherit;
}
p {
  hyphens: unset;
}
p {
  hyphens: revert;
}
p {
  hyphens: revert-layer;
}

The initial value is manual. Automatic hyphenation must be explicitly enabled with hyphens: auto.

Property Values

The three main values determine whether hyphenation is disabled, limited to explicit opportunities, or performed automatically.

Value Description
none Prevents words from being divided at hyphenation opportunities, including soft hyphens.
manual Allows hyphenation at explicitly indicated opportunities, such as soft hyphens, but does not automatically find additional positions.
auto Allows the browser to hyphenate words automatically using language-specific rules, as well as explicit hyphenation opportunities.
initial Resets the property to manual.
inherit Inherits the computed value from the parent element.
unset Inherits the parent's value because the property is inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value manual
Inherited Yes
Applies to All elements
Computed value As specified
Animation type Discrete
Percentages Not applicable
Related properties hyphenate-character, hyphenate-limit-chars, overflow-wrap, word-break

Hyphenation behavior also depends on the language of the text, the available line width, and the browser's line-breaking rules.

How It Works

When text reaches the edge of its available line width, the browser determines whether the next word fits. If it does not, the browser may use an eligible hyphenation opportunity to divide the word between lines.

Default Behavior

p {
  hyphens: manual;
}

The browser uses explicitly provided hyphenation opportunities but does not automatically hyphenate words using a language dictionary.

Enable Automatic Word Division

p {
  hyphens: auto;
}

The browser may identify additional hyphenation positions according to the text's language.

Prevent Hyphenation

p {
  hyphens: none;
}

Words are not divided at hyphenation opportunities, although other line-breaking rules may still allow breaks.

Important Consideration

The property controls hyphenation, not all text wrapping. Spaces, punctuation, emergency wrapping, and language-specific line-breaking behavior can still affect where lines break.

No Hyphenation

The none value prevents the browser from dividing words at automatic or manually supplied hyphenation opportunities.

Disable Hyphenation for Paragraphs

p {
  hyphens: none;
}

Disable Hyphenation for Headings

h1,
h2,
h3 {
  hyphens: none;
}

This is useful when word division would make short headings difficult to read.

Disable Hyphenation in Navigation

nav a {
  hyphens: none;
}

Important Consideration

The none value does not prevent all line breaks. For example, text can still wrap at spaces, and other CSS properties may introduce emergency breaks.

Manual Hyphenation

The manual value permits word division only at explicitly provided hyphenation opportunities.

Manual Hyphenation Rule

.manual-text {
  hyphens: manual;
}

HTML with a Soft Hyphen

<p class="manual-text">
  inter&shy;nationalization
</p>

The &shy; entity creates an optional hyphenation point after inter.

Multiple Manual Opportunities

<p class="manual-text">
  inter&shy;nation&shy;alization
</p>

The browser may use an eligible soft hyphen when a line break is needed.

Important Consideration

Manual hyphenation provides control over possible word divisions but does not force a line break. If the word fits on one line, the soft hyphen normally remains invisible.

Automatic Hyphenation

The auto value allows the browser to determine hyphenation opportunities using language-specific rules.

Enable Automatic Hyphenation

.article-text {
  hyphens: auto;
}

Identify the Language

<p lang="en" class="article-text">
  Internationalization and accessibility improve the usability of websites.
</p>

Constrain the Text Width

.article-text {
  max-width: 18rem;
  hyphens: auto;
}

Narrower text containers may make automatic hyphenation more likely because fewer words fit on each line.

Automatic Hyphenation in an Article

article {
  hyphens: auto;
  line-height: 1.6;
}

Important Consideration

Automatic hyphenation depends on browser support, language identification, and available hyphenation dictionaries. A browser may leave a word unbroken even when hyphens: auto is specified.

Soft Hyphens

A soft hyphen is an optional word-breaking character that identifies a possible hyphenation point within a word.

HTML Soft Hyphen Entity

<p>inter&shy;nationalization</p>

Soft Hyphen with Manual Hyphenation

p {
  hyphens: manual;
}

Soft Hyphen with Automatic Hyphenation

p {
  hyphens: auto;
}

The browser may use the explicit soft hyphen and additional language-specific hyphenation opportunities.

Soft Hyphen with Hyphenation Disabled

p {
  hyphens: none;
}

The soft hyphen does not create a hyphenation break when hyphenation is disabled.

Important Consideration

A soft hyphen is different from an ordinary visible hyphen. It normally remains invisible until the browser uses it as a line-breaking opportunity.

Do not insert soft hyphens unnecessarily into every word. They can complicate text editing, searching, copying, and maintenance.

Language Support

Automatic hyphenation uses language-specific rules. The HTML lang attribute helps browsers identify which hyphenation resources to apply.

English Text

<p lang="en">
  Internationalization improves accessibility across different websites.
</p>

German Text

<p lang="de">
  Die Internationalisierung verbessert die Benutzerfreundlichkeit.
</p>

French Text

<p lang="fr">
  L'internationalisation améliore l'accessibilité des sites web.
</p>

Shared CSS Rule

p {
  hyphens: auto;
}

The same CSS rule may produce different hyphenation positions for different languages.

Language-Specific Styling

p:lang(en) {
  hyphens: auto;
}
p:lang(de) {
  hyphens: auto;
}

Important Consideration

Not every browser provides hyphenation dictionaries for every language. Automatic hyphenation may be unavailable even when the language is correctly identified.

Hyphenation Characters

The hyphenate-character property controls the character or string displayed at a hyphenation break.

Default Hyphenation Marker

p {
  hyphens: auto;
  hyphenate-character: auto;
}

Standard Hyphen

p {
  hyphens: auto;
  hyphenate-character: "-";
}

Unicode Hyphen

p {
  hyphens: auto;
  hyphenate-character: "\2010";
}

Custom Marker

p {
  hyphens: auto;
  hyphenate-character: "•";
}

Important Consideration

The hyphens property determines whether hyphenation may occur. The hyphenate-character property changes the visible marker but does not create additional hyphenation opportunities.

Support for custom hyphenation markers varies across browsers.

Hyphenation Limits

The hyphenate-limit-chars property can restrict automatic hyphenation according to minimum word length and the number of characters before and after a break.

Minimum Character Requirements

p {
  hyphens: auto;
  hyphenate-limit-chars: 6 3 2;
}

This requests a minimum word length of six characters, at least three characters before the break, and at least two after it.

More Restrictive Hyphenation

p {
  hyphens: auto;
  hyphenate-limit-chars: 8 4 3;
}

Automatic Limits

p {
  hyphens: auto;
  hyphenate-limit-chars: auto;
}

Important Consideration

Character limits reduce eligible hyphenation positions. They do not force the browser to hyphenate a word or create new language-specific break points.

Responsive Typography

Automatic hyphenation can help narrow text columns use available space more efficiently, especially on smaller screens.

Responsive Article Text

.article-text {
  max-width: 65ch;
  line-height: 1.6;
  hyphens: auto;
}

Enable Hyphenation on Small Screens

.article-text {
  hyphens: manual;
}
@media (max-width: 600px) {
  .article-text {
    hyphens: auto;
  }
}

Narrow Sidebar Text

.sidebar-text {
  max-width: 16rem;
  hyphens: auto;
  overflow-wrap: break-word;
}

Disable Hyphenation in Headings

h1,
h2,
h3 {
  hyphens: none;
}

Important Consideration

Automatic hyphenation can improve line wrapping, but excessive word division may make text harder to read. Test different container widths, font sizes, and languages.

Hyphenation and Text Wrapping

Hyphenation is one part of CSS text wrapping. Other properties control emergency breaks, whitespace handling, and word-breaking behavior.

hyphens

p {
  hyphens: auto;
}

Allows the browser to divide words at valid hyphenation opportunities.

overflow-wrap

p {
  overflow-wrap: break-word;
}

Allows emergency breaks when an otherwise unbreakable string would overflow its container.

word-break

p {
  word-break: normal;
}

Controls word-breaking behavior according to language and line-breaking rules.

white-space

p {
  white-space: normal;
}

Allows normal whitespace collapsing and line wrapping.

Combined Text Wrapping

.article-text {
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

Important Consideration

Emergency breaks are not the same as hyphenation breaks. The browser does not necessarily display a hyphenation marker when overflow-wrap introduces a break.

Inheritance

The hyphens property is inherited. Descendant elements receive the parent's computed value unless another declaration overrides it.

Apply Hyphenation to an Article

article {
  hyphens: auto;
}

Disable Hyphenation in Headings

article h2,
article h3 {
  hyphens: none;
}

Explicit Inheritance

blockquote {
  hyphens: inherit;
}

Reset to the Initial Value

blockquote {
  hyphens: initial;
}

The initial value is manual.

Reset with unset

blockquote {
  hyphens: unset;
}

Because hyphens is inherited, unset behaves like inherit.

hyphens Example

This example compares manual and automatic hyphenation. The paragraphs use narrow containers to make word division easier to observe.

HTML Example

<div class="hyphens-demo">
  <div class="demo-panel">
    <h3>Manual Hyphenation</h3>
    <p lang="en" class="manual-text">
      Inter&shy;nationalization and accessibility improve website usability.
    </p>
  </div>
  <div class="demo-panel">
    <h3>Automatic Hyphenation</h3>
    <p lang="en" class="auto-text">
      Internationalization and accessibility improve website usability.
    </p>
  </div>
</div>

CSS Example

.hyphens-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.hyphens-demo .demo-panel {
  box-sizing: border-box;
  width: 170px;
  max-width: 100%;
  padding: 12px;
  border: 1px solid #cccccc;
  border-radius: 4px;
}
.hyphens-demo h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.hyphens-demo p {
  margin: 0;
  line-height: 1.6;
}
.hyphens-demo .manual-text {
  hyphens: manual;
}
.hyphens-demo .auto-text {
  hyphens: auto;
}
Browser Result

Manual Hyphenation

Inter­nationalization and accessibility improve website usability.

Automatic Hyphenation

Internationalization and accessibility improve website usability.

The first paragraph can break at the explicitly supplied soft hyphen. The second paragraph may use additional language-specific hyphenation opportunities when the browser supports automatic hyphenation for English.

Disable Hyphenation

.hyphens-demo .auto-text {
  hyphens: none;
}

This variation prevents the second paragraph from using hyphenation opportunities.

Add Character Limits

.hyphens-demo .auto-text {
  hyphens: auto;
  hyphenate-limit-chars: 6 3 2;
}

This variation restricts automatic hyphenation to positions that meet the specified minimum character requirements.

Common Mistakes

Expecting Automatic Hyphenation Without a Language

Browsers need language information to apply appropriate automatic hyphenation rules. Use an HTML lang attribute.

Assuming manual Enables Automatic Hyphenation

p {
  hyphens: manual;
}

The manual value allows explicitly supplied opportunities but does not automatically find additional word divisions.

Expecting none to Prevent All Line Breaks

p {
  hyphens: none;
}

Text can still wrap at spaces and other permitted line-breaking positions.

Using Invalid Values

p {
  hyphens: enabled;
}

The valid primary values are none, manual, and auto.

Confusing Hyphenation with Emergency Wrapping

The overflow-wrap property can introduce emergency breaks without inserting a hyphenation marker.

Adding Too Many Soft Hyphens

Unnecessary soft hyphens can make content harder to edit and maintain. Prefer automatic hyphenation when suitable language support is available.

Assuming All Browsers Use the Same Hyphenation Rules

Hyphenation dictionaries and line-breaking decisions may differ between browsers and operating systems.

Important Considerations

Keep the following points in mind when using hyphens:

  • The property controls whether words may be divided at hyphenation opportunities.
  • The initial value is manual.
  • The property is inherited.
  • The none value disables hyphenation.
  • The manual value allows explicitly provided hyphenation opportunities.
  • The auto value allows language-based automatic hyphenation.
  • Automatic hyphenation depends on the text's language and available browser resources.
  • The HTML lang attribute helps browsers select the correct language rules.
  • Soft hyphens provide optional manual hyphenation positions.
  • Hyphenation does not force a word to break when sufficient space is available.
  • The hyphenate-character property can customize the displayed marker.
  • The hyphenate-limit-chars property can restrict automatic hyphenation positions.
  • Emergency wrapping and hyphenation are different line-breaking mechanisms.
  • Automatic hyphenation can improve narrow text layouts but may reduce readability when overused.
  • Browser and language support should be tested with realistic content.

Browser Support

The CSS hyphens property is widely available in modern browsers, including Chrome, Edge, Firefox, Safari, and Opera.

Automatic hyphenation behavior may vary by browser, operating system, language, and available hyphenation dictionaries. Support for related properties such as hyphenate-character and hyphenate-limit-chars should be checked separately.

For current compatibility information, visit Can I Use? and search for hyphens.

Specifications

The hyphens property is defined in the CSS Text Module Level 3 specification, with additional hyphenation controls described in CSS Text Module Level 4.

CSS Text Module Level 3: hyphens

CSS Text Module Level 4

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: hyphens