CSS hyphenate-limit-chars Property
The CSS hyphenate-limit-chars property controls the minimum number of characters required in a word and on either side of a hyphenation break.
It helps prevent awkward word divisions by restricting where automatic hyphenation may occur. The property works with hyphens, which enables or controls hyphenation, and can improve the readability of narrow text columns, responsive layouts, and longer paragraphs.
hyphenate-limit-chars Syntax
The property accepts one, two, or three values. Each value is either auto or a non-negative integer.
Basic Syntax
selector {
hyphenate-limit-chars: auto;
}
One Value
p {
hyphenate-limit-chars: 6;
}
Sets the minimum word length to six characters. The before and after limits use their automatic values.
Two Values
p {
hyphenate-limit-chars: 6 3;
}
Sets the minimum word length to six characters and requires at least three characters on each side of the hyphenation break.
Three Values
p {
hyphenate-limit-chars: 6 3 2;
}
Requires a minimum word length of six characters, at least three characters before the break, and at least two characters after it.
Mixed Automatic and Numeric Values
p {
hyphenate-limit-chars: auto 3 2;
}
CSS-Wide Keywords
p {
hyphenate-limit-chars: initial;
}
p {
hyphenate-limit-chars: inherit;
}
p {
hyphenate-limit-chars: unset;
}
p {
hyphenate-limit-chars: revert;
}
p {
hyphenate-limit-chars: revert-layer;
}
The order of the three values is always minimum word length, minimum characters before the break, and minimum characters after the break.
Property Values
The property uses non-negative integers and the auto keyword to establish character limits for hyphenation.
| Value | Description |
|---|---|
auto |
Uses browser-defined automatic limits for word length and characters around a hyphenation break. |
<integer> |
Sets the minimum word length when used as the first value. |
<integer> <integer> |
Sets minimum word length and a shared minimum character count before and after the break. |
<integer> <integer> <integer> |
Sets minimum word length, minimum characters before the break, and minimum characters after the break independently. |
initial |
Resets the property to auto. |
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 | auto |
| Inherited | Yes |
| Applies to | Text elements and their descendants through inheritance |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
| Related properties | hyphens, hyphenate-character, overflow-wrap, word-break |
The character limits restrict eligible hyphenation positions. They do not insert hyphens or determine the visible hyphenation marker.
How It Works
When automatic hyphenation is enabled, the browser identifies possible word-breaking positions using language-specific rules. The hyphenate-limit-chars property adds minimum character requirements to those possible breaks.
Automatic Hyphenation Without Custom Limits
.article-text {
hyphens: auto;
hyphenate-limit-chars: auto;
}
The browser applies its automatic hyphenation limits.
Hyphenation with Character Limits
.article-text {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
The browser considers only hyphenation positions that satisfy the configured minimum word length and character counts, in addition to the language's hyphenation rules.
Example Word Division
Consider a hypothetical hyphenation opportunity in the word internationalization. A break is eligible under 6 3 2 only if the word has at least six characters, at least three remain before the break, and at least two remain after it.
Meeting these numeric conditions does not guarantee a break. The position must also be permitted by the language's hyphenation rules.
Important Consideration
The property limits hyphenation opportunities rather than creating new ones. It cannot force a word to break at a position that the browser does not recognize as a valid hyphenation opportunity.
Minimum Word Length
The first value sets the minimum number of characters a word must contain before it may be automatically hyphenated.
Minimum of Five Characters
p {
hyphens: auto;
hyphenate-limit-chars: 5;
}
Minimum of Eight Characters
p {
hyphens: auto;
hyphenate-limit-chars: 8;
}
Increasing the minimum word length reduces the number of words eligible for automatic hyphenation.
Compare Word-Length Limits
.less-restrictive {
hyphens: auto;
hyphenate-limit-chars: 5;
}
.more-restrictive {
hyphens: auto;
hyphenate-limit-chars: 10;
}
The second rule excludes shorter words from automatic hyphenation.
Important Consideration
The first value does not specify how many characters must appear on each side of the break. Use the second and third values for those limits.
Characters Before a Break
The second value specifies the minimum number of characters that must remain before a hyphenation break.
Require Three Characters Before the Break
p {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
At least three characters must remain on the first line before the hyphenation marker.
Require Four Characters Before the Break
p {
hyphens: auto;
hyphenate-limit-chars: 8 4 2;
}
This prevents eligible words from being divided after only one, two, or three characters.
Use an Automatic Before Limit
p {
hyphenate-limit-chars: 6 auto 2;
}
The browser determines the minimum number of characters before the break, while the minimum word length and after-break count remain explicitly defined.
Important Consideration
The second value is not a line-length limit. It controls the number of characters in the portion of the word preceding the hyphenation break.
Characters After a Break
The third value specifies the minimum number of characters that must remain after the hyphenation break.
Require Two Characters After the Break
p {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
Require Four Characters After the Break
p {
hyphens: auto;
hyphenate-limit-chars: 8 3 4;
}
This prevents the browser from leaving fewer than four characters of the divided word on the following line.
Use an Automatic After Limit
p {
hyphenate-limit-chars: 6 3 auto;
}
Important Consideration
Increasing the after-break minimum can reduce awkward word fragments, but it may also reduce the number of available hyphenation opportunities in narrow columns.
One, Two, and Three Values
The number of values determines which hyphenation limits are explicitly configured.
One Value
p {
hyphenate-limit-chars: 6;
}
The minimum word length is six characters. The before and after limits use auto.
Two Values
p {
hyphenate-limit-chars: 6 3;
}
The minimum word length is six characters, and both the before and after minimums are three characters.
Three Values
p {
hyphenate-limit-chars: 6 3 2;
}
The minimum word length is six characters, with three characters required before the break and two after it.
Value Comparison
| Declaration | Minimum Word | Before | After |
|---|---|---|---|
auto |
auto | auto | auto |
6 |
6 | auto | auto |
6 3 |
6 | 3 | 3 |
6 3 2 |
6 | 3 | 2 |
auto 3 2 |
auto | 3 | 2 |
Important Consideration
When only two values are provided, the second value applies to both sides of the break. Use three values when the before and after requirements must differ.
Automatic Values
The auto keyword allows the browser to select the corresponding limit using its built-in hyphenation behavior.
All Automatic Limits
p {
hyphenate-limit-chars: auto;
}
Automatic Word Length
p {
hyphenate-limit-chars: auto 3 2;
}
Automatic Before and After Limits
p {
hyphenate-limit-chars: 7 auto auto;
}
Automatic After Limit
p {
hyphenate-limit-chars: 7 3 auto;
}
Automatic values are useful when a specific restriction is needed without overriding every part of the browser's normal hyphenation behavior.
Important Consideration
The auto keyword does not represent one universal numeric value. Automatic limits may vary according to the browser and language-specific hyphenation behavior.
Relationship with hyphens
The hyphens property controls whether text may be hyphenated. The hyphenate-limit-chars property restricts eligible automatic hyphenation positions.
Disable Hyphenation
p {
hyphens: none;
hyphenate-limit-chars: 6 3 2;
}
With hyphenation disabled, the character limits do not produce automatic hyphenation breaks.
Manual Hyphenation
p {
hyphens: manual;
hyphenate-limit-chars: 6 3 2;
}
The manual value allows explicitly provided hyphenation opportunities, such as soft hyphens. The character limits are primarily intended to restrict automatic hyphenation.
Automatic Hyphenation
p {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
The browser may hyphenate words automatically when language rules, line-breaking conditions, and character limits permit it.
HTML Example
<p lang="en" class="article-text">
Internationalization and accessibility are important aspects of web development.
</p>
Important Consideration
Setting character limits does not enable automatic hyphenation. Use hyphens: auto when automatic word division is intended.
Language and Hyphenation
Automatic hyphenation depends on language-specific word-breaking rules. Browsers may use dictionaries or other language resources to determine valid hyphenation positions.
English Text
<p lang="en" class="article-text">
Internationalization improves the accessibility of multilingual websites.
</p>
German Text
<p lang="de" class="article-text">
Die Internationalisierung verbessert die Benutzerfreundlichkeit.
</p>
Shared CSS
.article-text {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
The numeric limits remain the same, but valid hyphenation opportunities may differ between languages.
Language-Specific Rules
.article-text:lang(en) {
hyphenate-limit-chars: 6 3 2;
}
.article-text:lang(de) {
hyphenate-limit-chars: 7 3 3;
}
Different limits can be applied when a design requires language-specific typography.
Important Consideration
Use the HTML lang attribute to identify the language of the text. CSS character limits cannot replace a language dictionary or establish valid linguistic break points.
Responsive Typography
Hyphenation can improve text wrapping in narrow columns, but excessive word division can make paragraphs difficult to read.
Standard Article Text
.article-text {
max-width: 65ch;
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
Narrow Mobile Columns
@media (max-width: 600px) {
.article-text {
hyphenate-limit-chars: 7 3 3;
}
}
This increases the minimum word length and after-break requirement on smaller screens. It may reduce awkward fragments, although fewer breaks can also produce uneven line lengths.
More Permissive Hyphenation
.narrow-column {
max-width: 16rem;
hyphens: auto;
hyphenate-limit-chars: 5 2 2;
}
Less restrictive limits allow more potential hyphenation positions when supported by the browser's language rules.
Important Consideration
There is no single ideal set of values for every layout. Test text with different word lengths, font sizes, languages, and container widths.
Related Text Properties
Several CSS properties affect word wrapping and hyphenation. They control different aspects of text layout.
hyphens
p {
hyphens: auto;
}
Controls whether manual or automatic hyphenation opportunities may be used.
hyphenate-character
p {
hyphenate-character: "\2010";
}
Controls the marker displayed when a word breaks at a hyphenation opportunity.
overflow-wrap
p {
overflow-wrap: break-word;
}
Allows additional emergency breaks when text would otherwise overflow its container.
word-break
p {
word-break: normal;
}
Controls word-breaking behavior according to language and line-breaking rules.
Combine Related Properties
.article-text {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
hyphenate-character: "-";
overflow-wrap: break-word;
word-break: normal;
}
Important Consideration
Emergency breaks created by overflow-wrap are not the same as automatic hyphenation breaks. The hyphenate-limit-chars property does not generally control those emergency breaks.
Inheritance
The hyphenate-limit-chars property is inherited. Descendant elements receive the parent's computed value unless another declaration overrides it.
Apply to an Article
article {
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
}
Override a Descendant
article .special-text {
hyphenate-limit-chars: 8 4 3;
}
Explicit Inheritance
blockquote {
hyphenate-limit-chars: inherit;
}
Reset to the Initial Value
blockquote {
hyphenate-limit-chars: initial;
}
Reset with unset
blockquote {
hyphenate-limit-chars: unset;
}
Because the property is inherited, unset behaves like inherit.
Important Consideration
When applying character limits to a parent container, nested text elements may inherit those limits. Use more specific selectors when different sections require different hyphenation rules.
hyphenate-limit-chars Example
This example compares two sets of hyphenation limits. Both paragraphs use automatic hyphenation, but the second requires longer word segments around each break.
HTML Example
<div class="hyphenate-limit-demo">
<div class="demo-panel">
<h3>Less Restrictive</h3>
<p lang="en" class="less-restrictive">
Internationalization and accessibility improve website usability.
</p>
</div>
<div class="demo-panel">
<h3>More Restrictive</h3>
<p lang="en" class="more-restrictive">
Internationalization and accessibility improve website usability.
</p>
</div>
</div>
CSS Example
.hyphenate-limit-demo {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.hyphenate-limit-demo .demo-panel {
box-sizing: border-box;
width: 170px;
max-width: 100%;
padding: 12px;
border: 1px solid #cccccc;
border-radius: 4px;
}
.hyphenate-limit-demo h3 {
margin: 0 0 10px;
font-size: 1rem;
}
.hyphenate-limit-demo p {
margin: 0;
hyphens: auto;
line-height: 1.6;
}
.hyphenate-limit-demo .less-restrictive {
hyphenate-limit-chars: 5 2 2;
}
.hyphenate-limit-demo .more-restrictive {
hyphenate-limit-chars: 8 4 3;
}
Less Restrictive
Internationalization and accessibility improve website usability.
More Restrictive
Internationalization and accessibility improve website usability.
In supporting browsers, the first paragraph permits more potential hyphenation positions. The second paragraph requires longer words and larger character groups around each break.
If both paragraphs appear identical, the browser may not support the property, the text may not require hyphenation, or the available language rules may produce the same eligible breaks.
Try a Three-Character Minimum
.hyphenate-limit-demo .less-restrictive {
hyphenate-limit-chars: 6 3 3;
}
This variation requires at least three characters on each side of a permitted break.
Use Automatic Limits
.hyphenate-limit-demo .more-restrictive {
hyphenate-limit-chars: auto;
}
This returns the second paragraph to the browser's automatic hyphenation limits.
Common Mistakes
Expecting Character Limits to Enable Hyphenation
p {
hyphenate-limit-chars: 6 3 2;
}
The property does not independently enable automatic hyphenation. Use hyphens: auto when appropriate.
Using Negative Values
p {
hyphenate-limit-chars: 6 -2 2;
}
Negative integers are invalid.
Using Percentages
p {
hyphenate-limit-chars: 50%;
}
The property accepts non-negative integers and auto, not percentages.
Using Too Many Values
p {
hyphenate-limit-chars: 6 3 2 2;
}
The property accepts no more than three values.
Misunderstanding Two-Value Syntax
p {
hyphenate-limit-chars: 6 3;
}
The second value applies to both the before and after character limits. It does not apply only to the before-break count.
Forgetting the Language Attribute
Automatic hyphenation depends on language-specific rules. Use an appropriate HTML lang attribute.
Expecting Limits to Create New Break Points
The property restricts existing hyphenation opportunities. It cannot create additional linguistic break points.
Confusing Hyphenation with Emergency Wrapping
Emergency breaks introduced by overflow-wrap are not governed by the same hyphenation character limits.
Important Considerations
Keep the following points in mind when using hyphenate-limit-chars:
- The property controls minimum character counts for automatic hyphenation.
- The initial value is
auto. - The property is inherited.
- It accepts one, two, or three values.
- Values must be
autoor non-negative integers. - The first value sets the minimum word length.
- The second value sets the minimum characters before a break.
- The third value sets the minimum characters after a break.
- When only two values are supplied, the second applies to both sides of the break.
- Automatic values allow the browser to determine the corresponding limits.
- The property does not enable automatic hyphenation by itself.
- The
hyphensproperty controls whether automatic hyphenation may occur. - The HTML
langattribute helps browsers apply language-specific rules. - The
hyphenate-characterproperty controls the displayed hyphenation marker. - More restrictive limits can reduce awkward word fragments but may also reduce wrapping opportunities.
- Browser support and hyphenation dictionaries may vary.
- Test the property with realistic content and responsive layouts.
Browser Support
The CSS hyphenate-limit-chars property has limited availability across browsers. Support for automatic hyphenation and language dictionaries can also vary by browser and operating system.
For current compatibility information, visit Can I Use? and search for hyphenate-limit-chars.
Browsers that do not recognize the property ignore the declaration and use their normal hyphenation behavior.
Specifications
The hyphenate-limit-chars property is defined in the CSS Text Module Level 4 specification.
CSS Text Module Level 4: hyphenate-limit-chars
The specification describes minimum word length and minimum character requirements around automatic hyphenation breaks.
For additional documentation and examples, consult MDN Web Docs.
