CSS overflow-wrap Property

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

What You’ll Learn

The overflow-wrap property tells the browser how to break long words or unbreakable text so it stays inside its container and does not cause horizontal overflow.

01

Word Wrapping

Handle long text.

02

normal Default

Default line breaks.

03

break-word

Prevent overflow.

04

Responsive Text

Narrow containers.

05

URLs & Links

Wrap long paths.

06

Readability

Cleaner layouts.

Introduction

The overflow-wrap property in CSS is used to specify how the browser should handle long words or unbreakable text that overflows the boundaries of its container.

This property helps improve the readability and layout of text content, especially in responsive design scenarios. It ensures that text does not break the layout or cause horizontal scrolling issues.

Definition and Usage

Use overflow-wrap: break-word on paragraphs, cards, sidebars, and links when content might include long strings without spaces, such as URLs, usernames, or generated identifiers.

The default normal value is fine for typical prose, but narrow layouts often need break-word to stay readable on small screens.

💡
Beginner Tip

Start with a fixed-width box and a very long unbroken word. Compare normal and break-word to see the difference immediately.

📝 Syntax

The overflow-wrap property can be applied to any block-level or inline-level element. It has the following syntax:

syntax.css
element {

  overflow-wrap: normal | break-word;

}

Here, value can be one of the predefined keywords described below.

Basic Example

overflow-wrap.css
.text-container {

  width: 200px;

  overflow-wrap: break-word;

}

Syntax Rules

  • Accepted values: normal and break-word.
  • The container usually needs a width or max-width for wrapping behavior to matter.
  • break-word breaks long words only when they would otherwise overflow.
  • Also known historically as word-wrap in older CSS.

🎯 Default Value

The default value of the overflow-wrap property is normal. This means that the browser will use its default line-breaking rules, which may not always prevent long words from overflowing their container.

Switch to break-word when unbroken strings would spill outside narrow boxes or cause horizontal scrolling.

⚡ Quick Reference

QuestionAnswer
Initial valuenormal
Applies toAll elements
InheritedYes
AnimatableNo
Common useWrapping long words, URLs, and unbreakable strings in narrow containers

💎 Property Values

ValueExampleDescription
normaloverflow-wrap: normal;Allows words to overflow their container if they do not fit. This is the default behavior.
break-wordoverflow-wrap: break-word;Breaks long words and wraps them onto the next line to prevent overflow. This value ensures that even if a word is too long to fit, it will break to avoid horizontal scrolling.
normal — default line breaks break-word — wrap long words

👀 Live Preview

Same long unbroken word in narrow boxes with normal vs break-word:

normal
verylongwordwithoutanybreakpoints
break-word
verylongwordwithoutanybreakpoints

Examples Gallery

Wrap long words, compare defaults, handle URLs, and keep sidebar text inside narrow layouts.

💬 Word Wrapping Basics

Use overflow-wrap: break-word to prevent long strings from overflowing narrow containers.

Example 1 — break-word on a Text Container

In this example, we’ll apply the overflow-wrap property to a paragraph element to handle long words gracefully.

break-word.html
<style>

  .text-container {

    width: 200px;

    border: 1px solid #ccc;

    padding: 10px;

    overflow-wrap: break-word;

  }

</style>



<div class="text-container">

  This is an example of a verylongwordthatwillbreakandwrapcorrectlyinsideitscontainerwithoutcausinganyoverflowissues.

</div>
Try It Yourself

How It Works

The browser breaks the long unbroken string onto multiple lines instead of letting it overflow the 200px box.

Example 2 — Default normal Behavior

Compare the default normal value with a long unbroken string in the same narrow container.

normal-default.css
.text-container {

  width: 200px;

  overflow-wrap: normal;

}
Try It Yourself

How It Works

With normal, the browser may allow the word to extend beyond the container width.

🔗 Real-World Use Cases

URLs, sidebars, and responsive text blocks benefit from break-word.

Example 3 — Long URL in a Card

Wrap a long URL inside a card using overflow-wrap: break-word on the link.

url-wrap.css
.link-card a {

  overflow-wrap: break-word;

}
Try It Yourself

How It Works

Long paths break across lines so the link stays inside the card instead of stretching the layout.

Example 4 — Responsive Sidebar Text

Use overflow-wrap: break-word on sidebar paragraphs with user-generated content.

sidebar-wrap.css
.sidebar p {

  max-width: 100%;

  overflow-wrap: break-word;

  line-height: 1.5;

}
Try It Yourself

How It Works

Even without spaces, the text wraps within the sidebar’s max width on small screens.

Works with word-break and overflow-x

overflow-wrap handles word breaking to prevent overflow. Pair it with word-break for stronger break rules, or use overflow-x when you need horizontal scrolling instead of wrapping.

wrap-companion.css
.code-snippet {

  max-width: 100%;

  overflow-wrap: break-word;

  overflow-x: auto;

}

♿ Accessibility

  • Prevent horizontal scrolling — Wrapping long strings helps users on small screens avoid sideways panning.
  • Keep links readable — Broken URLs remain clickable when wrapping is applied thoughtfully.
  • Avoid excessive mid-word breaks — Use break-word only where overflow would otherwise harm layout.
  • Test with zoom — Text reflow at larger font sizes should still stay within containers.

🧠 How overflow-wrap Works

1

Text fills a container

A word or string may be longer than the available line width.

Content
2

overflow-wrap value is applied

normal keeps default rules; break-word allows breaks to prevent overflow.

Value
3

Lines wrap inside the box

Long words move to the next line instead of stretching the layout horizontally.

Wrap
=

Readable responsive text

Content stays inside its container without unwanted horizontal overflow.

Browser Compatibility

The overflow-wrap property is widely supported across modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. It is a reliable solution for managing text overflow issues in most web environments.

Baseline · Modern browsers

Excellent support everywhere

normal and break-word work reliably in all current major browsers.

98% Modern browser support
Google Chrome 1+ · Desktop & Mobile
Full support
Mozilla Firefox 3.5+ · Desktop & Mobile
Full support
Apple Safari 3.1+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 10.5+ · All versions
Full support
overflow-wrap property 98% supported

Bottom line: Safe to use for text wrapping in all modern projects.

Conclusion

The overflow-wrap property is a valuable tool for controlling how text content behaves when it exceeds its container.

By using this property, you can improve the readability and user experience of your website by ensuring that text wraps correctly and avoids causing layout problems. Experiment with different values to see how they affect your text content and find the best fit for your design needs.

💡 Best Practices

✅ Do

  • Use break-word on narrow cards, sidebars, and links
  • Set a width or max-width on text containers
  • Apply wrapping to URLs and user-generated content
  • Test on mobile screen sizes
  • Combine with sensible line-height for readability

❌ Don’t

  • Confuse overflow-wrap with overflow-x
  • Force break-word on every element by default
  • Rely on horizontal scrolling when wrapping is the better UX
  • Forget that normal may still overflow narrow boxes
  • Assume wrapping fixes all layout issues without container sizing

Key Takeaways

Knowledge Unlocked

Five things to remember about overflow-wrap

Use these points when long words threaten your layout.

5
Core concepts
02

Default normal

Standard breaks.

Default
📝 03

break-word

Wrap long strings.

Values
🔗 04

URLs & Sidebars

Common use case.

Use case
05

Not overflow-x

Different property.

Companion

❓ Frequently Asked Questions

overflow-wrap controls how the browser breaks long words or unbreakable strings so they fit inside their container instead of overflowing horizontally.
The default value is normal, which lets the browser use its default line-breaking rules and may allow long words to overflow.
overflow-wrap breaks words only when needed to prevent overflow, while word-break can force breaks at any character depending on its value.
Use break-word on narrow containers, cards, sidebars, and links when long URLs or unbroken strings might cause horizontal overflow.
No. overflow-x controls horizontal scrolling and clipping, while overflow-wrap controls whether long words wrap onto the next line.

Practice in the Live Editor

Open the HTML editor and experiment with overflow-wrap: normal and break-word on long strings.

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