Text Justifier & Column Aligner
Trims each line and expands short lines with at least two words to a target UTF-16 string length by adding spaces between words. It does not wrap text or measure visual width.
About this text justifier & column aligner
Trims each line and expands short lines with at least two words to a target UTF-16 string length by adding spaces between words. It does not wrap text or measure visual width Applies Unicode-compliant text transformations and parsing directly in the browser tab without data leakage.
Text processing & transformation mechanics
Trims each input line; for a line with at least two words shorter than the supplied width, distributes the required spaces across word gaps from left to right. Lines with fewer than two words or already at/over width are only trimmed.
Worked text manipulation example
Scenario: A typesetter justifies plain text to equal left and right margins by distributing inter-word spaces.
Sample input:
Second field:
Processing: For four words totaling 21 code units at width 30, distribute nine spaces equally over three gaps.
Illustrative output:
Character encoding & string length boundaries
Width must be a finite safe integer; values below 1 are clamped to 1, and an empty width defaults to 40. Each line is handled separately; lines with fewer than two words or already at least as long as the width are only trimmed. The tool does not wrap, hyphenate, or preserve internal whitespace.
Text formatting and transformations in Text Justifier & Column Aligner preserve character integrity. Check edge cases such as multi-line inputs and special characters before downstream use.
In-memory text processing boundary
String operations and Unicode manipulations in Text Justifier & Column Aligner execute entirely in local browser memory without transmitting input text.
Unicode Consortium & text formatting standards
Unicode Consortium standard annexes (UAX) and character encoding specifications:
- ECMAScript UTF-16 String.length and ordinary space insertion.
- Local per-line expansion of eligible short multiword text to target code-unit length; no font measurement, wrap, hyphenation or column parsing.
Text Justifier & Column Aligner verification · Audit standards
How to use it
- Enter text with the line breaks you want to process separately.
- Enter a target width in the second input, or leave it empty for 40, then run locally.
- Read or copy the text with spaces distributed between words on eligible lines.
Frequently asked questions
How are spaces distributed?+
Each input line is trimmed and split at whitespace. If it has at least two words and is shorter than the width, ordinary spaces are distributed across gaps from left to right.
How can I see a complete justification example?+
Set width to `10` and enter `a bb ccc`. The output is `a bb ccc`: two spaces in each gap, for exactly ten characters.
Which lines are not expanded?+
A line with fewer than two words, or one already at least as long as the width, is returned trimmed without added spaces.
Which widths are valid?+
A missing, `null`, or blank width is 40. A supplied width must be a finite safe integer; values below 1 become 1. It uses string length and ordinary spaces, not font measurements.
