Skip to content
← Typography Tools

Hyphenation and Justification Tester

Test hyphens, text-wrap balance, text-wrap pretty, and hanging-punctuation against your real content to find the cleanest text setting.

Related Tools

Related Tool
Typography Scale
Related Tool
Vertical Rhythm Calculator
Related Tool
Letter-Spacing Optimizer
Related Tool
Responsive Type Calculator

Modern CSS text-wrap (2023 onwards)

text-wrap is a CSS property, first shipped in Chrome 114 in May 2023, that lets you choose how the browser breaks lines. The two interesting values are balance (for headings, make every line roughly equal length) and pretty (for paragraphs, avoid orphan words on the last line). Both eliminate the kind of typesetting awkwardness that previously required JavaScript or careful manual line breaks.

Browser support arrived in waves: Chrome shipped balance in version 114 (May 2023) and pretty in 117 (September 2023). Firefox shipped balance in 121 (December 2023). Safari shipped balance in 17.5 (May 2024) and pretty only in Safari 26 (September 2025); Firefox does not support pretty yet (MDN browser compatibility data, checked October 2026). The fallback is the default line-breaking algorithm, so the page still renders fine; it just loses the polish.

Hyphens for justified text

The CSS hyphens property controls whether the browser inserts hyphenation breaks inside long words. hyphens: auto turns on dictionary-based hyphenation using the language specified by the lang attribute. hyphens: manual respects only the soft-hyphen characters you have added by hand. hyphens: none disables hyphenation entirely. For long-form content in narrow columns, hyphens: auto is what makes justified text not look terrible.

Hyphenation depends on the lang attribute being set correctly. lang=en gets English hyphenation rules; lang=de gets German rules. Without lang, the browser may fall back to incorrect rules or skip hyphenation. The Tester surfaces this by letting you set the language live and see the effect.

Common Use Cases

Editorial publications use text-wrap balance on every headline to eliminate the embarrassing one-word last line. E-commerce product pages use text-wrap pretty on description paragraphs to keep the last line from being a stranded single word. Documentation sites use hyphens auto inside narrow code-example callouts to break long identifiers cleanly.

Internationalized content benefits the most. German and Finnish have very long compound words that overflow narrow columns without hyphenation. Setting the lang attribute correctly and enabling hyphens auto often fixes that, where the browser has a dictionary for the language (Chrome has German but not Finnish; see below).

Worked example: what balance and pretty actually change

On October 12, 2026 we set a headline and a paragraph in Chromium 141 at several column widths and measured the width of every line (in px) with text-wrap set to wrap, balance and pretty.

Text and columnwrap (line widths)balancepretty
Headline, 28 px, 320 px column300 / 236 / 137251 / 204 / 217same as wrap
Paragraph, 16 px, 360 px357 / 321 / 346 / 194289 / 292 / 316 / 320same as wrap
Paragraph, 16 px, 320 px… / 40 ("script.")—… / 67 ("any script.")
Paragraph, 16 px, 264 px… / 40 ("script.")—6 lines, last 67 ("any script.")

Frequently Asked Questions

What is the difference between text-wrap balance and pretty?
balance distributes text evenly across every line in a block. It is ideal for headlines and titles where you want every line to be roughly the same length. pretty optimizes the last line specifically, preventing a single word from being stranded alone (a typographic orphan). It is ideal for body paragraphs. balance is more expensive to compute and the browser limits it to short blocks (six lines or less); pretty is cheaper and works on any length.
Is there a performance cost?
Both cost more than the default because the browser compares several possible line breaks, but on ordinary pages the difference is not noticeable. Balancing is deliberately limited to short blocks: Chromium only balances blocks of up to six lines and leaves longer text with normal wrapping, which is why balance is meant for headings. Use pretty for body text.
Do I need to set the lang attribute for hyphens to work?
Yes. hyphens: auto needs a hyphenation dictionary and the browser chooses it from the lang attribute on the element or an ancestor; without a language it cannot hyphenate reliably. Set lang on the html element and override it on elements in other languages. Dictionaries also differ by browser: Chrome and Edge have none for Finnish or Polish, for example, while Firefox and Safari do (MDN browser compatibility data).
What is hanging-punctuation?
hanging-punctuation is a CSS property that pushes opening and closing punctuation marks slightly outside the text column, so the visual edge of the text aligns with the visible glyphs rather than with the punctuation. It is most useful for blockquotes that begin with quotation marks. Only Safari supports it (since Safari 10, 2016); Chrome, Edge and Firefox do not, per MDN, so in those browsers the toggle changes nothing. Without it, a leading quote looks indented; with it, the text appears flush to the column edge.
Can I combine hyphens and text-wrap?
Yes, and they work together well. hyphens auto enables hyphenation breaks inside long words; text-wrap pretty optimizes line-break placement; combining them gives the browser more options to produce well-balanced lines. The Tester shows the combined effect so you can dial in the exact stack for your content.
Does text-wrap work on flex and grid children?
Yes, because text-wrap is a property of the text inside an element, not of the element layout. A flex item, a grid cell, a table cell, and a regular block all support text-wrap balance and pretty equally. The width of the container determines where lines break; text-wrap optimizes the break placement within that width.
What about non-Latin scripts like Arabic or CJK?
text-wrap balance and pretty work for any script. The line-breaking algorithm is script-aware. Hyphenation, however, is largely Latin-script-specific because most non-Latin scripts have different line-breaking conventions. CJK does not hyphenate; it breaks between any two characters. Arabic has its own rules. For non-Latin content, use text-wrap freely and skip hyphens.
Will old browsers break if I use these?
No. Unsupported CSS values are silently ignored. A browser that does not recognize text-wrap: balance falls back to text-wrap: wrap, which is the default line-breaking. The page renders without the polish but does not break. Same for hyphens auto and hanging-punctuation. This makes all three properties safe to ship without feature detection.