Line Sorter

Sort lines alphabetically, numerically, by length, or in natural order

Read only

0 lines sorted

What is the Line Sorter?#

The Line Sorter puts a scattered list back in order. Paste text with one item per line, and it returns the same lines sorted alphabetically, by length, or by number.

It suits address lists, file names, and exported data. Options control how lines are compared and whether blank or repeated lines stay in the result.

How to Use#

  1. Paste your text, one item per line, into the input box.
  2. Pick how to sort the lines and switch the options as needed.
  3. Check the line counts, then copy the result.

What the Options Do#

  • Alphabetical: sorts lines A to Z in dictionary order. Letter case is ignored unless you turn that off.
  • Natural (number-aware): works like alphabetical, but runs of digits compare as numbers. file2 comes before file10.
  • Numeric: compares each whole line as a number, from small to large. Lines that are not numbers go last.
  • By length: puts short lines first. Lines of the same length fall back to alphabetical order.
  • Ascending / Descending: flips the sort direction. Descending reverses the result; in the numeric sort, lines that are not numbers stay last either way.
  • Ignore case: treats Apple and apple as the same line when comparing. Turn it off to keep them apart.
  • Trim spaces: removes leading and trailing spaces before comparing. The result shows the trimmed lines.
  • Remove empty lines: drops blank lines from the result. Useful for cleaning up extra line breaks left over from copying.
  • Remove duplicates: keeps only the first occurrence of each repeated line from the input.

Common Use Cases#

  • Sorting a mailing list or a roster of names before sharing it.
  • Putting numbered file names such as img2.png and img10.png in the right order.
  • Arranging timestamped log lines from the oldest entry to the newest.
  • Ordering keywords by length to pick out the shortest ones.

FAQ#

Notes#

  • The output always uses Unix line breaks (LF), even when the input contains Windows (CRLF) or old Mac (CR) line breaks.
  • Full-width and half-width letters and digits are not normalized, and "Remove duplicates" does not merge them. With "Ignore case" on, they compare as equal and keep their original order when sorting; with it off, they are sorted apart.
  • Formatter

Last updated:

Related tools