Text Justifier

Wrap text to a set line width and justify it so every line (except the last) reaches both edges evenly, the way printed columns and typeset paragraphs look.

runs locally on your browser. Your data never leaves your device.

Alignment

0Words
0Lines
60Line Width

Common Use Cases

Format a plain-text email or README section into clean, evenly-edged paragraphs
Re-wrap code comments or ASCII documentation to a fixed column width
Justify a paragraph of body text for a printed or monospace-styled document
Left-wrap, right-align, or center pasted text to a specific character width for terminal or CLI output

About Text Justifier

Justified text, where every line in a paragraph is stretched to reach exactly the same width on both the left and right edges, is what gives newspaper columns, typeset books, and printed documents their clean, block-shaped look. It's done by re-wrapping the words to a target width and then distributing extra spaces between the words on each line until the line reaches that width exactly, without touching the words themselves.

This tool re-wraps any pasted text to a line width you choose (in characters, which is what matters for plain-text and monospace contexts: code comments, terminal output, plain-text emails, ASCII documentation) and justifies each line by spreading extra spaces evenly between words. When a line's spaces don't divide evenly, the leftover space is distributed one extra character at a time starting from the earliest gaps, the same approach used by classic typesetting and word processors. The last line of a paragraph is left as-is by default, since a fully stretched final line (often just one short word spread across the whole width) usually looks wrong; there's a toggle to force it fully justified anyway if that's what you need.

Besides full justification, the tool also supports plain left-aligned wrapping (just re-wrap, no space-stretching), right-alignment, and centering, useful for formatting ASCII banners, README sections, or code comments where you want the wrap without the justified block look. Multiple paragraphs (separated by a blank line) are re-wrapped independently by default, so blank lines in your original text are preserved as paragraph breaks rather than being swallowed into one continuous block.

Everything happens with plain JavaScript directly in your browser: nothing you paste is uploaded, logged, or transmitted anywhere.

Frequently Asked Questions

How does the justify algorithm decide where to add extra spaces?
For each line, the tool first works out how many extra spaces are needed beyond one single space per gap to reach the target width, then divides that total evenly across the gaps between words. If it doesn't divide evenly, the leftover spaces are added one at a time to the leftmost gaps first, so a line with 3 extra spaces over 2 gaps puts 2 spaces in the first gap and 1 in the second, the same left-to-right distribution used by classic typesetting and most word processors' justify feature.
Why isn't the last line of my paragraph fully justified?
By default, a paragraph's last line is left exactly as wrapped (normal single spaces between words, ragged on the right), because stretching a short final line (sometimes just one or two words) across the full width usually looks worse than leaving it short, which is also how most word processors and typesetting software behave by default. Turn on 'Justify last line' if you specifically want every line, including the last one of each paragraph, stretched to the full width.
What happens to a word that's longer than the line width?
It's placed on its own line without being truncated or broken; the line will simply be wider than your target width for that one word, since the tool never cuts a word in the middle. A hint below the output tells you when this has happened so it doesn't look like a bug.
Does it respect the paragraph breaks (blank lines) in my original text?
Yes, by default. Text is split into paragraphs wherever there's a blank line, and each paragraph is wrapped and justified independently, so existing paragraph breaks are preserved in the output. Turn off 'Preserve paragraph breaks' to treat the entire input as one continuous block of text and re-wrap it from scratch, ignoring the original line breaks entirely.
Is my text uploaded anywhere while it's being formatted?
No. Wrapping and justifying both happen with plain JavaScript directly in your browser as you type or paste. Nothing is uploaded, logged, or transmitted anywhere, and the tool keeps working even if your connection drops after the page has loaded.