Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use white-space: normal for ordinary wrapping, overflow-wrap: anywhere for long URLs or unbroken strings, and table-layout: fixed when the table must remain within a defined width:
table {
width: 100%;
table-layout: fixed;
}
td {
white-space: normal;
overflow-wrap: anywhere;
}
A sentence with spaces usually wraps automatically. A single uninterrupted word, URL, filename, UUID, or hash may not have a natural place to break, so it needs an explicit overflow-wrapping rule.
Why text overflows a <td>
Text in a table cell can overflow for several different reasons:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- The content is one long string with no spaces or other natural line-break opportunities.
- A stylesheet applies
white-space: nowrap. - The table uses automatic layout and expands a column to accommodate its content.
- A link, span, code element, or other descendant has conflicting sizing or whitespace rules.
- The cell has a width declaration, but the table itself is still free to resize.
These are related problems, but they require different fixes. Hiding overflow does not create a place for text to wrap, and setting a cell width alone does not always constrain a table using the automatic layout algorithm.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
A complete modern example
This example keeps the table within its available width and allows both normal prose and exceptionally long tokens to wrap:
<table class="wrap-table">
<colgroup>
<col class="id-column">
<col class="description-column">
<col class="status-column">
</colgroup>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Description</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">21</th>
<td>This is ordinary text that can wrap, including an exceptionally-long-identifier-if-needed.</td>
<td>Accepted</td>
</tr>
</tbody>
</table>
.wrap-table {
width: 100%;
max-width: 600px;
table-layout: fixed;
border-collapse: collapse;
}
.wrap-table th,
.wrap-table td {
padding: 0.5rem;
border: 1px solid #999;
vertical-align: top;
white-space: normal;
overflow-wrap: anywhere;
}
.id-column {
width: 4rem;
}
.description-column {
width: 50%;
}
.status-column {
width: 7rem;
}
Using <colgroup> and <col> makes column sizing explicit. With table-layout: fixed, the browser bases the layout primarily on the table width, column widths, and borders or spacing instead of allowing a long token to dictate the column size. A known table width is important; without one, there may be no meaningful width constraint to enforce.
white-space: allow or prevent ordinary wrapping
The normal setting is:
td {
white-space: normal;
}
white-space: normal permits normal line wrapping and collapses runs of whitespace. Check for a rule such as this if text refuses to wrap:
Recommended Free Tools
td {
white-space: nowrap;
}
nowrap prevents normal wrapping. Search the cascade, including rules applied to links, spans, buttons, and utility classes. white-space controls line-wrapping behavior, but it does not guarantee that a single unbroken word will be split.
Use overflow-wrap for long words and URLs
For most table content, the preferred general-purpose declaration is:
td {
overflow-wrap: anywhere;
}
This permits the browser to break an otherwise unbreakable string when it would overflow the cell. It is useful for long URLs, hashes, generated identifiers, filenames, and repeated characters.
Rank #2
You can also use:
td {
overflow-wrap: break-word;
}
Both values help contain long strings, but they are not identical in intrinsic sizing. anywhere also considers the possible breaks when calculating the element’s min-content size, which can matter in constrained layouts. break-word is a common practical choice when preserving older terminology or compatibility behavior matters.
You may encounter the older declaration:
td {
word-wrap: break-word;
}
word-wrap is now a legacy alias for overflow-wrap, not a separate modern mechanism. Lead with overflow-wrap in new CSS.
overflow-wrap versus word-break
Do not automatically replace overflow-wrap with word-break: break-all:
td {
word-break: break-all;
}
break-all can split between almost any two characters. It prevents overflow aggressively, but it can make English prose harder to read by breaking ordinary words even when the whole word could fit on the next line.
| Requirement | Approach | Trade-off |
|---|---|---|
| Normal sentences | white-space: normal |
Unbroken tokens may still overflow. |
| Long URLs or identifiers | overflow-wrap: anywhere |
Breaks may look visually awkward. |
| Preserve normal words where possible | overflow-wrap: break-word |
Intrinsic sizing differs from anywhere. |
| Break at nearly every character | word-break: break-all |
Often harms readability. |
Use word-break: break-all only when character-level breaking is acceptable, such as a highly compact interface or a content-specific writing system.
Wrapping links, spans, URLs, and generated content
overflow-wrap and white-space are inherited, so applying them to the cell usually affects text inside descendants such as links and spans:
Rank #3
td,
td a,
td span {
white-space: normal;
overflow-wrap: anywhere;
}
The explicit descendant selectors are useful when another rule overrides inheritance. Inspect the computed styles of the actual overflowing element if a cell-level rule appears ineffective. A child with white-space: nowrap, display: inline-block, or a restrictive width may be the real cause.
URLs often contain few or no spaces. You can wrap a visible URL with overflow-wrap: anywhere, but consider whether showing the entire address is necessary. A shorter visible label can retain the full destination in href; other options include a copy button, an expandable detail view, or horizontal scrolling.
Identifiers, hashes, and code need a deliberate choice
Breaking a hash, invoice number, tracking code, or source-code fragment may make it harder to read or copy. Choose based on the value’s purpose.
Free tools Windows power users keep installed
One-click scans. No signup required.
To keep the value inside the cell:
.identifier {
overflow-wrap: anywhere;
}
To preserve one-line code-like content and allow horizontal scrolling:
.identifier {
white-space: pre;
overflow-x: auto;
}
If visual line breaks could be mistaken for semantic characters, provide a copy action and make clear that the copied value is the original unbroken string.
Wrapping is different from clipping, ellipsis, and scrolling
overflow: hidden only controls content that has already overflowed. It can clip text, but it does not create line-break opportunities:
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
/* Fully visible, wrapped text */
td {
white-space: normal;
overflow-wrap: anywhere;
}
/* One-line truncation */
.summary {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* One-line content that remains available by scrolling */
.code-value {
white-space: pre;
overflow-x: auto;
}
Use ellipsis only when hiding part of the value is acceptable and the full content remains available through an accessible disclosure, detail view, or equivalent interaction. Use scrolling for code, hashes, and other values whose internal sequence should remain intact.
Why max-width on a cell may not be enough
A table cell does not always behave like an ordinary block element. Under automatic table layout, the browser can resize columns around their contents, so a cell’s max-width may not produce the constraint you expect.
For predictable behavior, constrain the table itself:
table {
width: 100%;
table-layout: fixed;
}
td {
overflow-wrap: anywhere;
}
Then set proportions or fixed widths on <col> elements, header cells, or cells. Fixed layout may make narrow columns taller because content wraps more aggressively, but that is usually preferable to an expanding or overflowing table on a responsive page.
Debugging checklist
- Test with an ordinary sentence. If it does not wrap, inspect
white-space. - Test with a deliberately long URL or token. If only that fails, add
overflow-wrap. - Inspect the computed width of the actual table and cell.
- Confirm
widthandtable-layout: fixedare applied to the rendered table, not merely to a parent or another table. - Inspect nested
<a>,<span>, and<code>elements fornowrap, restrictive widths, or nonstandard display values. - Check rows using
colspanorrowspan; spanning cells make column calculations less intuitive. - Check replaced content such as images, SVGs, inputs, and buttons. Text-wrapping rules do not resize those elements.
For images and SVGs, responsive constraints may be needed:
img,
svg {
max-width: 100%;
height: auto;
}
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Do not add <br> to fix arbitrary overflow
A <br> forces a break at one chosen location. It is appropriate when that specific break is part of the content, not as a general solution for long words or responsive cells. CSS wrapping rules handle changing widths more reliably.
Best Value
Historical context: the 2010 SitePoint discussion
The original SitePoint thread dates from October 2010, when Internet Explorer 6–8 behavior strongly influenced web-development advice. Its working suggestion used word-wrap: break-word, and the discussion correctly recognized that the example was a single long word rather than merely a long sentence.
That historical solution remains recognizable because word-wrap is an alias, but current guidance should use overflow-wrap and address table sizing separately. Browser-specific workarounds involving <br> belong to that legacy context and should not be treated as general modern practice without testing a specific obsolete-browser requirement.
Use tables for data, not page layout
Use <table> when the content has genuine row-and-column relationships. Mark column headings with <th scope="col"> and row headings with <th scope="row">. Give cells meaningful labels so the relationship remains understandable to screen-reader users.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchDo not use tables solely to position page elements. Use CSS Grid or Flexbox for layout interfaces. New markup should also use a standards doctype, such as <!doctype html>, and CSS rather than presentational HTML attributes such as align, valign, border, cellpadding, and cellspacing.
Quick decision guide
- Normal prose: ensure
white-space: normaland provide a usable table width. - Long URLs or random strings: add
overflow-wrap: anywhere. - Columns must not expand: combine a table width with
table-layout: fixedand explicit column widths. - Full value is not needed: use accessible truncation or a shortened display label.
- Code or hashes must remain intact: use one-line scrolling and provide copying.
- General page layout: replace the table with Grid or Flexbox.
For reference, see the MDN overflow-wrap reference, MDN white-space reference, MDN table-layout reference, and the original SitePoint discussion.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

