text-wrap PlaygroundCompare balance, pretty, stable, wrap, and nowrap side-by-side at the same width. balance evens out line lengths for headings; pretty avoids the orphan last line in prose; stable stops layout shift while editing. Live width slider, last-line metrics, copy-ready CSS.
Tip: drag the width slider — stable keeps lines from reflowing as the box grows; balance rebalances every change.
Tip Apply text-wrap: balance only to short text (≤6 lines). Browsers cap the algorithm — too long and it silently falls back to wrap. For paragraphs, use pretty instead.
wrap default — normal greedy line-breaking. First line fills, last line gets whatever's left.nowrap — never break. Long content overflows the container; useful inside a flex child you want to text-overflow: ellipsis.balance Chrome 114+, Firefox 121+, Safari 17.5+ — minimize the difference between line lengths. Capped at ~6 lines by Chromium. Heading-grade typography.pretty Chrome 117+, Safari 17.5+, Firefox no — avoid a single-word orphan on the last line and tweak hyphenation choices for paragraphs.stable Chrome 117+, Firefox 124+ — when the user edits a contenteditable or you mutate text, the previously-rendered lines don't reflow above the caret. Critical for editors.All values are progressive enhancements — unsupported browsers fall back to wrap with no JS shim needed.