CSS text-wrap balance vs pretty: Where Each Belongs

Use text-wrap: balance on headings, captions and pull quotes, where you want lines of roughly equal length. Use text-wrap: pretty on paragraphs, where you want to stop a single word sitting alone on the last line. Balance evens out every line of a short block. Pretty mostly repairs the ending.

That is the short answer to text-wrap balance vs pretty. The rest of this post is about the limits each browser puts on them, because that is where “it does nothing” bugs come from.

Text-wrap balance vs pretty: what does each value do?

Both are values of text-wrap-style, defined in the CSS Text Module Level 4 editor’s draft. Neither adds or removes places where a line may break. They change how the browser picks among the breaks that already exist.

balance chooses breaks that even out the empty space at the end of each line across the whole block. For five lines or fewer, the spec says balancing must not change the number of lines, so your heading keeps its height and loses the stub underneath.

pretty tells the browser to favour a better result over speed and to look at several lines when deciding where to break. What it improves is left to the browser. The spec lists short last lines, uneven line lengths, typographic rivers and runs of consecutive hyphenated lines as candidates, and the two engines that ship it have picked different subsets (more on that below).

There are two more values you will meet. stable keeps the lines before the cursor still while someone types in an editable region, so the paragraph does not reflow under their caret. avoid-short-last-line is in the spec as a cheaper, orphan-only version of pretty, but as of November 2026 MDN’s browser compatibility data lists no browser support for it.

Why does text-wrap: balance do nothing on my heading?

Usually because the block is too long. Balancing is expensive to compute, so Chromium and Firefox cap it. Chrome’s own documentation says it only works for six wrapped lines and under. MDN gives ten or fewer for Firefox. The spec allows exactly this: a browser may treat balance as auto once there are more than ten lines. Go past the cap and the text wraps normally, with no warning in the console.

That bites on mobile. A heading on four lines at desktop width can wrap to seven on a narrow phone, and balancing switches off at the width where the stub looks worst. Safari is the exception: WebKit says it does not cap the number of balanced lines at all.

The second cause is width. Balancing redistributes words inside the box. It does not shrink the box. Chrome’s docs say so directly, and say you need a maximum line length, such as max-inline-size, before balancing has anything to work with.

That also explains the odd result on a heading inside a card with a border or a background colour. The text is balanced, but the box still spans the full width. The band of empty space on the right looks like a bug.

The third is forced breaks. The spec processes groups of lines separated by a <br> separately, so a heading split with <br> gets balanced as two short blocks, not one. If you are using <br> to fix the rag by hand, take it out and let balance do it.

If you want to catch the line cap during development, this snippet lists every balanced element that has more lines than Chromium will balance:

// Paste into the DevTools console, or run from a dev-only script.
const CHROMIUM_BALANCE_LIMIT = 6;

for (const el of document.querySelectorAll("h1, h2, h3, h4, figcaption, blockquote")) {
  const style = getComputedStyle(el);
  if (style.textWrapStyle !== "balance" && style.textWrap !== "balance") continue;

  // "normal" line-height has no fixed pixel value; approximate it.
  const lineHeight =
    style.lineHeight === "normal"
      ? parseFloat(style.fontSize) * 1.2
      : parseFloat(style.lineHeight);

  const lines = Math.round(el.getBoundingClientRect().height / lineHeight);
  if (lines > CHROMIUM_BALANCE_LIMIT) {
    console.warn(`${lines} lines, balance ignored in Chromium:`, el);
  }
}

Run it at your narrowest breakpoint. That is where the warnings appear.

How is text-wrap: pretty different in Chrome and Safari?

Chrome shipped pretty in version 117. Its announcement describes it as focused on orphans: it stops a paragraph ending on a single word, and it can fix consecutive hyphenated lines at the end of a paragraph. According to the WebKit team, Chromium only adjusts the last four lines of a paragraph. Everything above those lines wraps exactly as it did before.

Safari shipped pretty in Safari 26, on macOS and iOS, and WebKit took a wider view. Its implementation considers every line of the paragraph, so it evens out the rag down the whole right-hand edge, avoids short last lines, and reduces how often it needs to hyphenate. WebKit says it does not yet try to prevent rivers.

Firefox does not support pretty at all: MDN’s compatibility data, last published on 12 November 2026, lists it as unsupported. Firefox ignores the declaration and wraps the usual way, so you do not need @supports. The worst case is the text you already have.

The practical result: put pretty on a paragraph and Chrome users see one fewer orphan, Safari users see a visibly tidier paragraph, and Firefox users see no change. Do not sign off a design in Safari and expect Chrome to match it.

Does text-wrap: pretty slow down the page?

The spec warns that the computation “may be expensive, especially when applied to large amounts of text” and asks authors to measure. MDN says pretty has a negative effect on performance.

WebKit is more specific. It says the cost depends on how many lines are in a single text element, not how many elements you apply it to, and that you would need “many hundreds or thousands of lines” in one element before it showed.

A blog article split into normal paragraphs is fine. The cases worth testing are a single enormous unbroken block, such as a legal page pasted in as one paragraph, and text that rewraps on every frame, such as a container whose width you are animating. Layout work done during an interaction counts against your interaction responsiveness, which we covered in our guide to fixing INP. If a profile shows layout time jumping on those elements, switch them back to auto.

Should I use the shorthand or text-wrap-style?

text-wrap is a shorthand for text-wrap-mode (wrap or nowrap) and text-wrap-style. Like any shorthand, it resets the longhand you leave out. Writing text-wrap: balance also sets text-wrap-mode back to wrap.

Usually that is harmless. It catches you when a parent sets text-wrap: nowrap on purpose (a nav item, for example) and a child rule written as text-wrap: balance turns wrapping back on. The longhand text-wrap-style: balance changes only the style and leaves the inherited mode alone.

The longhand is newer: MDN’s data puts it at Chrome 130, Firefox 124 and Safari 17.5, against Chrome 114 for text-wrap: balance. An older Chromium drops the longhand as unknown and wraps normally, which is a safe failure, so we use the longhand in new stylesheets.

Here is the baseline we start a project with:

h1,
h2,
h3,
h4,
figcaption,
blockquote {
  text-wrap-style: balance;
  max-inline-size: 40ch;
}

p,
li,
dd {
  text-wrap-style: pretty;
}

[contenteditable] {
  text-wrap-style: stable;
}

Tune max-inline-size to your type scale. If a card needs its heading to fill the full width, drop the limit for that component and accept that balance has less to do. The same heading can behave very differently in a narrow card and a wide one, which is a good reason to set widths with container queries rather than media queries.

Where we would not use either

We would not put balance on body text. A five-line paragraph balanced to equal lengths reads like a poem and wastes the right edge. Nor would we use it in a bordered or filled box without checking the empty band it leaves.

We would not use pretty on interface labels, buttons, table cells or anything else one or two lines long. There is nothing for it to improve.

And we would delete any JavaScript balancing library once these rules are in. Chrome, Firefox and Safari have all balanced headings natively since 2024, so a script doing the same job is now dead weight.

Line wrapping is a small part of the responsive web design work we do, where one component has to read well from a 320px phone to a wide desktop. We check headings and body copy at each breakpoint in Chrome, Safari and Firefox, since pretty alone gives three different results.

Need this built properly?

Get in touch

Hack the planet!