Sort Lines

Sort a list A to Z, Z to A, by number, by length, by last word, or shuffle it. Optionally drop duplicates.

How it works

Put one item on each line and pick how to sort. A to Z uses your language's alphabet rules, so accented letters sort where you expect. Turn on "Natural order" so item2 comes before item10, and "Ignore case" so Apple and apple sort together.

Sort by number picks the first number it finds in each line (commas are allowed, like 1,200), and lines with no number go to the end. This is useful for marks lists, prices and roll numbers.

Worked example

The lines "file10", "file2", "file1" sort to file1, file10, file2 in plain A to Z, but to file1, file2, file10 with Natural order on. Numeric sort of "Aman 78", "Riya 91", "Karan 66" gives Karan 66, Aman 78, Riya 91.

Good to know

Common questions

How do I sort a list of names by surname?
Choose "By last word". It uses the last word on each line.
Why is 10 before 2?
Plain text sort compares character by character. Use Natural order or Sort by number.
Is the sort stable?
Yes. Lines that compare as equal keep their original order.
How many lines can I sort?
Tens of thousands run fine in a browser.

More in Text.