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
- Tick "Remove duplicates" to get a clean unique list in one step.
- Trim spaces first if lines have invisible spaces at the ends. They can change the order.
- Shuffle is random each time you change an option, so copy the result you like.
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.
Write a money amount in words for cheques and invoices, like "Rupees One Lakh Only".
OPEN →Bold Text GeneratorMake bold text you can paste into Instagram, WhatsApp, X and LinkedIn, and get the WhatsApp markup that works without special letters.
OPEN →Bubble Text GeneratorPut every letter and number inside a circle, a square or brackets, in white or black bubbles.
OPEN →