CSS word-break Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The word-break property controls whether line breaks may appear inside words when text would otherwise overflow its content box. It is most useful for long URLs, hashes, and unbroken strings in narrow cards, table cells, or chat bubbles.

The property is inherited. The initial value is normal. Pair it with overflow-wrap and white-space when you tune wrapping behavior.

Baseline widely available.

Core values (normal, break-all, keep-all) work across modern browsers. break-word is deprecated. auto-phrase is experimental (limited engines).

CSS Syntax

syntax.css
word-break: normal | break-all | keep-all | auto-phrase | break-word | initial | inherit;

Example: word-break: break-all;. Use one keyword at a time.

Property Values

ValueDescriptionTry it
normalDefault line-break rules for the languageTry it
break-allMay break between any two characters (non-CJK) to avoid overflowTry it
keep-allDo not break CJK words; non-CJK acts like normalTry it
auto-phraseExperimental. Prefer natural phrase boundaries (e.g. Japanese with lang)Limited
break-wordDeprecated. Like overflow-wrap: anywhere + word-break: normalTry it
initialResets to the default value, normalTry it
inheritInherits this property from the parent elementTry it

How to Use word-break

Give the text a fixed width, then choose how aggressively long strings may split.

  1. Put text in a box with a constrained width (card, column, or table cell).
  2. Start with normal. Switch to break-all only for URLs, hashes, or similar tokens.
  3. For everyday paragraphs, prefer overflow-wrap: anywhere or break-word so breaks happen only when needed.
  4. For CJK copy that should stay together, try keep-all. Set the correct lang on the document or element.
PieceRequired?Role
Constrained widthYesWithout a narrow box, breaks are hard to see
word-break keywordYesChooses how mid-word breaks are allowed
overflow-wrapOptionalSofter alternative for wrapping long strings
hyphensOptionalMay add hyphens at language-aware break points

Live Preview

A narrow box with one long string. Change word-break and watch whether the text wraps or overflows.

The sample string has no spaces, so normal often overflows while break-all wraps character by character.

Narrow box
Honorificabilitudinitatibushttps://example.com/very/long/path?token=abc123xyz

word-break: normal

CSS Examples

Each snippet focuses on word-break in a narrow box so the wrap behavior is easy to see. Use Try It Yourself for a live editor.

Example 1 — Default (normal)

Use the default line-break rules. A long string with no spaces may overflow.

CSS
<style>
  p {
    width: 160px;
    border: 1px solid #334155;
    padding: 8px;
    word-break: normal;
  }
</style>

<p>Thisisaverylongwordthathasnospace</p>
Try It Yourself

How It Works

  1. Constrain width. width: 160px makes overflow easy to spot.
  2. Set word-break: normal. This is the initial value — language-default break rules.
  3. No spaces means few break points. Latin text usually breaks at spaces, so this string may stick out.
  4. Compare with Example 2. break-all will wrap mid-character instead.

Example 2 — break-all

Allow a break between any two characters so a long URL or token fits the box.

CSS
<style>
  p {
    width: 160px;
    border: 1px solid #334155;
    padding: 8px;
    word-break: break-all;
  }
</style>

<p>https://example.com/docs/very/long/path?id=12345</p>
Try It Yourself

How It Works

  1. Same narrow box as Example 1 so you can compare.
  2. Set break-all. The browser may insert a break at the overflow edge, even mid-word.
  3. Best for tokens. URLs, hashes, and code identifiers often have no spaces.
  4. Avoid on prose. Mid-word breaks hurt readability in normal paragraphs — prefer overflow-wrap there.

Example 3 — keep-all (CJK)

Keep Chinese, Japanese, or Korean words from breaking between characters.

CSS
<style>
  p {
    width: 160px;
    border: 1px solid #334155;
    padding: 8px;
    word-break: keep-all;
  }
</style>

<p lang="zh">這是一個非常長的詞組用來示範</p>
Try It Yourself

How It Works

  1. Set lang. Language hints help the browser apply the right rules.
  2. Use keep-all. CJK text should not break between characters the way normal often allows.
  3. Non-CJK is unchanged. Latin text still follows normal rules under keep-all.
  4. Pick the right tool. For Japanese phrase wrapping in Chromium, see experimental auto-phrase.

Edge Cases & Pitfalls

Most mistakes come from using break-all on prose or mixing it up with overflow-wrap.

deprecated

break-word is deprecated

Prefer overflow-wrap: anywhere. word-break: break-word still works widely but is not the modern choice.

experimental

auto-phrase is experimental

Limited support (notably Chromium for Japanese with lang="ja"). Do not rely on it as the only wrapping strategy.

vs wrap

break-all vs overflow-wrap

break-all can break even when moving the whole word to the next line would fit. overflow-wrap is usually gentler for readable text.

white-space

white-space: nowrap wins

If wrapping is disabled with white-space, word-break cannot create new lines. Check wrapping is allowed first.

manual

manual is not supported yet

The spec lists manual for Southeast Asian break control, but browsers do not support it today.

Browser Support

word-break is a browser CSS property for text layout. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

word-break

Core values normal, break-all, and keep-all are widely supported. break-word works but is deprecated. auto-phrase is limited (Chromium family).

98% Core values
Google Chrome Supported
Full support
Mozilla Firefox Supported
Full support
Apple Safari Supported
Full support
Microsoft Edge Supported
Full support
Opera Supported
Full support
Samsung Internet Supported
Full support
Internet Explorer 5.5+
Partial (no keep-all early)
word-break Baseline · Widely available

Bottom line: Safe to use for everyday wrapping control. Treat auto-phrase as progressive enhancement. This is not a JavaScript runtime API.

Key Takeaways

  • Role: decide if long words may break mid-character to avoid overflow.
  • Initial: normal. Inherited. One keyword at a time.
  • break-all for URLs/tokens; keep-all for CJK; prefer overflow-wrap for prose.
  • Avoid legacy: skip new uses of deprecated break-word; treat auto-phrase as experimental.

One line: word-break stops narrow boxes from blowing out on long strings — use the softest value that still fits.

Frequently Asked Questions

It controls whether the browser may insert line breaks inside words or long strings when text would otherwise overflow its content box.
The initial value is normal. The browser uses the default line-break rules for the language.
Use break-all for long unbroken strings such as URLs, hashes, or code tokens in a narrow box. Prefer overflow-wrap for regular paragraph text so words break only when needed.
keep-all stops word breaks in Chinese, Japanese, and Korean (CJK) text. Non-CJK text behaves like normal.
Yes. Prefer overflow-wrap: anywhere (or overflow-wrap: break-word) for soft wrapping of long strings. break-word still works in many browsers for compatibility.
Yes. It applies to all elements and is inherited. It is a browser CSS property, not a Node.js feature.

Next: word-spacing

Learn how to control the space between words.

word-spacing tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful