TextToolboxTextToolbox

Justify Text

Justify existing lines, reflow paragraphs or normalize ASCII word gaps. Choose width 20 to 300 graphemes and inspect final and over-width rows.

Built by Saurabh Kumar

Quick Answer

Use literal spaces for grapheme-count justification. Existing Lines expands nonfinal paragraph rows, Reflow greedily wraps contiguous prose paragraphs, and Normalize Spacing uses one space per gap. Final rows stay left-aligned; long tokens are never split or hyphenated.

Layout

Width is 20 to 300 graphemes, not pixels or terminal cells. Final paragraph rows stay left-aligned; single tokens and over-width tokens are never split. Normalize Spacing uses width only for over-width counts.

0 output lines. 0 UTF-16 units including separators. 0 expanded rows; 0 over-width rows. Source separators retained outside paragraph reflow.

Spreading ASCII Word Gaps to a Chosen Width

Adjust ASCII word gaps for a width of 20 to 300 graphemes. Justify existing lines, reflow paragraphs or normalize spacing. Grapheme counts keep joined characters together but do not measure pixels or terminal cells. No newspaper typography, automatic hyphenation or email-compliance guarantee is implied. It fits plain-text layouts where nonfinal ASCII prose rows should expand, paragraph reflow of copied prose without splitting long words, and spacing cleanup that normalizes only ASCII token gaps.

Choosing a Justify Mode and Width

  1. Paste prose or load Sample.
  2. Choose Justify Existing Lines, Reflow Paragraphs or Normalize Spacing.
  3. Set a whole-number width from 20 to 300 graphemes. For Normalize Spacing it only controls over-width counts.
  4. Inspect expanded and over-width rows. Final paragraph rows and single-token rows stay left-aligned.
  5. Copy or Download TXT. Select the output manually if Copy fails.

How Spaces Are Divided and Rows Are Packed

ASCII spaces and tabs delimit tokens; other characters remain inside them. Nonblank line edges are stripped of ASCII spaces/tabs and token gaps normalized before layout. Blank or whitespace-only lines are retained. Intl.Segmenter counts graphemes with locale en. Extra spaces divide across gaps, with the remainder added to leftmost gaps.

Existing Lines keeps physical separators, justifying every nonfinal row of each contiguous nonblank paragraph. Reflow joins those rows into tokens and greedily packs them within the chosen width. New internal separators use the first source separator or LF; the paragraph's final source separator and blank separators remain. Normalize Spacing keeps physical rows and uses one space per gap.

Long tokens are kept intact even if they exceed width. No mode inserts hyphens or splits Unicode clusters. Unlike a rendering engine's justification, this creates literal spaces; the destination must preserve them.

One Width, Three Modes

Width 20, input A B C followed by D on a new line:

Exact option comparisons
OptionResult
Justify Existing Lines
A + 9 spaces + B + 8 spaces + C, then D
Reflow Paragraphs
A B C D (one final row, no expansion)
Normalize Spacing
A B C, then D

Where Justified Plain Text Breaks

Short final rows stay ragged, and a single-token row cannot expand word gaps. Existing Lines does not wrap over-width lines; Reflow does not truncate long tokens. CJK text without ASCII gaps is one token. Tabs normalize to spaces, meaningful indentation is lost on nonblank rows, and this is unsuitable for code or tabular data.

Graphemes are not visual columns: wide glyphs, proportional fonts, bidirectional text and runtime Unicode differences can affect appearance. Input is limited to 1,000,000 UTF-16 units and 20,000 lines. Output is capped at 5,000,000 units and 20,000 lines; missing segmentation, invalid width or oversized output disables export. Browser paste/Copy may normalize endings.

Use a short ASCII sample to inspect the destination first. Preserve your original before reflowing. For adding leading spaces without changing word gaps, use Center Text. Download failures leave the output available for Copy or manual selection.

Share This Tool

Share this free text justification tool with writers and designers!