CSS word-wrap Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The word-wrap property tells the browser whether it may break long words when they overflow — a simple fix for narrow layouts and unbroken strings.

01

Overflow

Prevent text spill.

02

Syntax

Two keywords.

03

normal

Default value.

04

break-word

Wrap long words.

05

overflow-wrap

Modern alias.

06

URLs

Card layouts.

Introduction

The word-wrap property in CSS is used to specify whether or not the browser should break words when they overflow the content area. This can be particularly useful for preventing long words from stretching the layout of a web page and ensuring that text content remains readable and aesthetically pleasing.

In modern CSS, word-wrap is a legacy alias for overflow-wrap. Both names work in browsers today, but new projects should prefer overflow-wrap for clarity.

Definition and Usage

Apply word-wrap on text containers with a fixed or max width — cards, sidebars, comment boxes, and mobile columns. It works alongside word-break and white-space to control how text flows when space is limited.

💡
Beginner Tip

When a long URL or unbroken string pushes outside its box, try word-wrap: break-word; (or overflow-wrap: break-word;). The browser breaks the word only when it would otherwise overflow.

📝 Syntax

The syntax for the word-wrap property is straightforward. It can be applied to any element that contains text content.

syntax.css
element {
  word-wrap: normal | break-word;
}

Basic Example

word-wrap.css
.wrapper {
  width: 200px;
  word-wrap: break-word;
}

Syntax Rules

  • Accepted values: normal and break-word.
  • The container usually needs a width or max-width for wrapping to matter.
  • break-word breaks inside a word only when necessary to prevent overflow.
  • Modern equivalent: overflow-wrap: break-word;
  • The property is inherited.

Related Properties

  • overflow-wrap — standard name for the same behavior
  • word-break — more aggressive break rules inside words
  • white-space — controls space collapsing and line wrapping
  • hyphens — adds hyphenation at break points when supported

🎯 Default Value

The default value of the word-wrap property is normal, meaning that words will only break at normal line break points (such as spaces or hyphens).

⚡ Quick Reference

QuestionAnswer
Default valuenormal
Wrap long unbroken wordsword-wrap: break-word;
Modern equivalentoverflow-wrap: break-word;
More aggressive breaksword-break: break-all;
InheritedYes

💎 Property Values

The word-wrap property accepts two keyword values.

ValueExampleDescription
normalword-wrap: normal;Words break only at normal line break points (default).
break-wordword-wrap: break-word;Words may break at arbitrary points if necessary to prevent overflow.
normal break-word

When to Use word-wrap

word-wrap helps whenever long unbroken strings meet narrow containers:

  • Responsive cards — Keep text inside fixed-width UI on mobile.
  • Long URLs and emails — Prevent horizontal scrolling in comments and chat.
  • User-generated content — Handle unpredictable strings gracefully.
  • Sidebars and widgets — Maintain layout when space is tight.
  • Legacy codebases — Existing styles may still use word-wrap; it remains valid.

👀 Live Preview

Same long string with normal vs break-word in a narrow box:

Thisisaverylongwordwithoutspaces
normal
Thisisaverylongwordwithoutspaces
break-word

Examples Gallery

In this example, we’ll use the word-wrap property to ensure that long words break and wrap onto the next line to prevent overflow.

📜 Core Patterns

Wrap long unbroken strings inside narrow containers.

Example 1 — break-word on a long string

In this example, we’ll use the word-wrap property to ensure that long words break and wrap onto the next line to prevent overflow.

index.html
<style>
  .wrapper {
    width: 200px;
    border: 1px solid #000;
    word-wrap: break-word;
  }
</style>

<div class="wrapper">
  Thisisaverylongwordthatwillbreakandwrapontothenextline.
</div>
Try It Yourself

How It Works

The 200px width constrains the box. break-word lets the browser split the long string across lines instead of overflowing.

Example 2 — normal vs break-word

See how the default normal value behaves compared to break-word on the same long word.

compare.css
.normal { word-wrap: normal; }
.break-word { word-wrap: break-word; }
Try It Yourself

How It Works

With normal, a single long word may overflow or clip. break-word wraps it inside the box.

📄 Real-World Layouts

Handle URLs and migrate to the modern overflow-wrap name.

Example 3 — Long URLs in a card

Prevent share links from overflowing narrow mobile layouts.

url.css
.url {
  word-wrap: break-word;
}
Try It Yourself

How It Works

URLs have no natural spaces. break-word splits them only when the link would otherwise overflow the card.

Example 4 — word-wrap vs overflow-wrap

Both properties produce the same result in modern browsers. Prefer overflow-wrap in new stylesheets.

modern.css
/* Legacy */
.legacy { word-wrap: break-word; }

/* Modern standard */
.modern { overflow-wrap: break-word; }
Try It Yourself

How It Works

Browsers treat word-wrap as an alias for overflow-wrap. Use whichever name your team prefers, but document the modern name for new code.

♿ Accessibility

  • Prevent horizontal scroll — Wrapping long strings helps users with low vision and motor difficulties who struggle with sideways scrolling.
  • Readabilitybreak-word is gentler than word-break: break-all because it breaks only when needed.
  • Screen readers — Visual line breaks do not change spoken text, but clearer layout still aids comprehension.
  • Zoom — Test wrapping at 200% browser zoom on narrow viewports.

word-wrap + word-break

Start with overflow-wrap: break-word (or word-wrap: break-word) for general content. Add word-break: break-all only on elements like URLs or code where more aggressive breaks are acceptable.

wrap-pair.css
.content {
  overflow-wrap: break-word;
}

.url {
  word-break: break-all;
}

🧠 How word-wrap Works

1

Text reaches container edge

A long word or URL has no spaces to break on.

Input
2

word-wrap sets break rules

break-word allows breaking inside the word when overflow would occur.

Rules
3

Browser wraps or overflows

Text continues on the next line or spills out if breaking is not allowed.

Layout
=

Contained readable text

Content fits the layout without breaking the page.

Browser Compatibility

The word-wrap property is supported in all modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. It is also supported in older versions of Internet Explorer (starting from IE 5.5). You can use it confidently across a wide range of web browsers.

Modern browsers · Widely supported

Legacy alias, broad support

All major browsers support normal and break-word on word-wrap and the equivalent overflow-wrap.

99% Browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support

Testing tip

Test with real URLs and long unbroken strings on narrow mobile widths and at 200% zoom.

word-wrap property 99% supported

Bottom line: word-wrap is safe to use everywhere. Prefer overflow-wrap in new stylesheets.

Conclusion

The word-wrap property is a simple yet effective tool for managing how text content behaves when it overflows its container.

By allowing or preventing words from breaking at arbitrary points, you can maintain the readability and layout integrity of your web pages. Experiment with this property to see how it can enhance the presentation of your text content.

💡 Best Practices

✅ Do

  • Use break-word on narrow cards and sidebars
  • Prefer overflow-wrap in new CSS files
  • Set a max-width on text containers
  • Test wrapping on mobile and with browser zoom
  • Combine with sensible line-height for readability

❌ Don’t

  • Confuse word-wrap with word-break
  • Expect wrapping without a width constraint
  • Use break-all when break-word is enough
  • Ignore horizontal overflow on small screens

Key Takeaways

Knowledge Unlocked

Five things to remember about word-wrap

Use these points when handling long unbroken text.

5
Core concepts
🕐 02

normal

Default value.

Default
🔀 03

break-word

Prevent spill.

Pattern
🔄 04

overflow-wrap

Modern name.

Standard
🌐 05

word-break

Companion tool.

Related

❓ Frequently Asked Questions

word-wrap controls whether the browser may break long words when they would overflow their container. break-word allows breaking inside a word only when needed to prevent overflow.
The default is normal, which only breaks at normal line break points such as spaces and hyphens.
Yes. word-wrap is the legacy name. overflow-wrap is the modern standard property with the same behavior.
word-wrap (overflow-wrap) breaks long words only when necessary to prevent overflow. word-break can force breaks at any character depending on its value.
Prefer overflow-wrap: break-word in new projects. word-wrap still works in all browsers but is considered a legacy alias.

Practice in the Live Editor

Open the HTML editor and compare normal vs break-word in narrow boxes.

HTML Editor →

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