In typography, the setting of lines of text so that they line up on the left and right, as opposed to ragged right, in which the lines do not line up on the right.
The earliest books, handwritten by scribes, began as unjustified, but were later justified by the medieval scribes to speed writing, to fit as many characters on a line as possible, and for aesthetic reasons. Gutenberg (and other early printers) desired their printed books to look as much like handwritten manuscripts as possible, so lines were set with numerous contractions and ligatures to achieve justification. Later, metal type required even copy blocks to allow lockup into page form.
Justification is accomplished by filling a line until the last possible word or syllable fits and then dividing the remaining space by the number of word spaces. The result is placed at each word space. This is why word spaces vary in width from line to line, expanding or contracting as needed to space the line out to its justification width. Margins are the imaginary vertical demarcations for text or tabular columns. Overall or primary margins are established by the line length function or the cumulative total of secondary margins (tab or text columns). Ragged right (or unjustified) is recommended for continuing text, since the eye needs an imaginary reference line on the left. The advantages of ragged right include fewer (or no) hyphenations, even word spacing, white space at line ends to allow type to "breathe," a more relaxed look, and no rivers.