Sort Lines

Alphabetise, order by number or length, reverse or shuffle. The original stays on the left.

Order

Options

Processed in your browser. No signup.

What this tool does

Sort Lines reorders a pasted list nine different ways: alphabetically in either direction, naturally, by the number at the start of each line, by length, reversed, or shuffled at random. The list you pasted stays untouched on the left, so you can try an order, look at it, and try another.

The orders

A → Z and Z → A

Alphabetical using your browser's own language rules, so accented letters land where a reader of that language would expect rather than after the whole alphabet.

Natural

Alphabetical, except that digits inside a line are compared as numbers. item2 comes beforeitem10 instead of after it, which is almost always what you want for file names and versioned labels.

Numeric ↑ and ↓

Sorts by the number at the start of each line. Lines that do not begin with a number keep their relative order and are placed at the end.

Shortest and longest first

Orders by line length. Lines of equal length keep their original order.

Reverse order

Flips the list end to end without sorting it.

Shuffle

Random order, using a Fisher–Yates shuffle. Press Shuffle again for a different arrangement. This uses the browser's ordinary random number generator, so it is fine for picking a running order and not suitable for anything where fairness must be guaranteed.

Example

The list file10, file2, file1 sorts to file1, file10, file2 with A → Z, but tofile1, file2, file10 with Natural.

Options

  • Case sensitive — off by default, so Apple and apple sort together. On, capitals sort before lowercase.
  • Trim each line first — removes leading and trailing spaces from the output as well as the comparison.
  • Drop blank lines — on by default, so gaps do not collect at one end.
  • Remove duplicates too — deduplicates while sorting, for when you want both in one pass.

Useful cases

  • Alphabetising a list of names, tags or keywords.
  • Putting versioned file names in sensible order.
  • Sorting an export by the number at the start of each row.
  • Randomising a running order or a set of prompts.

Privacy

Sorting runs in your browser. Nothing you paste is uploaded or stored.