Text Line Sorter

Sort the lines of a text alphabetically or by length.

Text Line Sorter speeds up a small but time-consuming task that comes up often when working with text. Text Line Sorter completes this text task in seconds, without the manual back-and-forth. The whole process happens locally in your browser; nothing is sent to a server.

Step-by-step

  1. Paste your list into the 'Text' box with one item per line. If your list is comma separated, turn the commas into line breaks first.
  2. Under 'Sort by', choose 'alpha' for alphabetical order or 'length' to sort by how long each line is.
  3. Under 'Order', pick 'asc' for A to Z or shortest first, or 'desc' for Z to A or longest first.
  4. Click 'Run', then copy the sorted list from the result area.

Example

You've collected names for a school trip from several teachers by email and the combined list is in no particular order. Paste it in, sort alphabetically in ascending order, and you have a roll call sheet ready to print. Any name entered twice ends up on two neighboring lines, which makes duplicates easy to spot by eye.

Sorting by length is less obvious but handy. Put a list of product titles, meta descriptions or SMS texts in descending length order and the lines that push against a character limit rise to the top, so you know which ones to shorten first.

How does sorting work?

The tool splits your text into lines and sorts each line as one item. So each item must be on its own line; a comma-separated list has to be split into lines first.

Practical tips

  • The tool drops empty lines from the result; if you want blank gaps, add them after sorting.
  • Alphabetical sorting follows the language rules of the page language (Turkish letters like ç, ğ, ı, ö, ş, ü land in the right place on the Turkish page); you can also sort by length.
  • Sorting is textual, not numeric: 1, 2, 10 becomes 1, 10, 2. To sort numbers, pad them with leading zeros (01, 02, 10).

Common mistakes

  • Trying to sort a comma-separated list that sits on a single line.
  • Including the header row in the sort.
  • Expecting numeric ordering.
  • Overwriting the original list without keeping a copy.

Things to keep in mind

  • Letters outside the basic Latin alphabet, such as Turkish ç, ş or ı, or accented letters like é, may not land where a dictionary would put them. Check those lines if the order matters.
  • Lines starting with uppercase and lowercase letters can end up in separate groups. Normalizing the case first gives a cleaner result.
  • A leading space or an invisible character will throw a line out of place. If one item looks misplaced, check the start of that line.
  • Lines that begin with numbers are sorted as text, so 10 may come before 2. Pad numbers to the same width, like 02 and 03, if you need numeric order.