Multi-line Text Sorter

Sort lines alphabetically, numerically, by length, or reverse

Ad placeholder (leaderboard)

Sorting a list by hand is tedious and error-prone. This tool splits your input on line breaks and reorders it instantly using whichever rule you pick, with optional case folding and whitespace trimming so messy pasted lists come out clean.

How it works

The input is split on newlines into an array of strings, then sorted with a comparison function chosen by mode:

  • Alphabetical uses the locale-aware localeCompare, optionally folding case.
  • Numeric parses the leading number of each line with parseFloat and compares the values, sending non-numeric lines to the end.
  • Length compares the character count of each line.
  • Reverse does no comparison at all; it simply flips the existing order.

The sort is stable, so equal lines keep their original sequence.

Tips and examples

Numeric mode reads from the start of the line, so 10 apples sorts as 10, which means lines like 12-inch and 9-inch order correctly by their leading number. For mixed lists, sort alphabetically first, then de-duplicate with the companion Duplicate Line Remover. Turn on trimming whenever you paste from a spreadsheet or terminal, where trailing tabs are common and would otherwise push lines to unexpected positions.

Ad placeholder (rectangle)