What does the sort lines tool do?
Paste a list with one item per line, such as names, keywords, file names, references or tasks, and get it back in the order you need. Sorting a list by hand is slow and error-prone; sorting in a spreadsheet means copying data in and out. This tool does it instantly in your browser.
Alphabetical sorting uses natural order, which understands numbers inside text. A plain computer sort puts “item 10” before “item 2” because it compares character by character; natural sorting gives the order a person expects: item 1, item 2, item 10. It also respects accented letters, so “Émile” sorts with the E names.
How to use it
- Paste your lines into the left box.
- Choose a sort order: A to Z, Z to A, by length, reversed or shuffled.
- Tick case sensitive if uppercase and lowercase should sort separately, and remove duplicates if each item should appear once.
- Copy the sorted list from the right box. In shuffle mode, click Shuffle again for a new order.
Sort orders explained
- A → Z: alphabetical, natural number order, case-insensitive by default.
- Z → A: the same, reversed.
- Shortest / longest first: by number of characters, then alphabetically for lines of equal length.
- Reverse: flips the current order without sorting, which is handy for logs or ranked lists.
- Shuffle: a fair random order using the Fisher–Yates algorithm and your browser's secure random generator, so every ordering is equally likely.
Example
The lines Zebra, apple, Mango, item 10, item 2, banana, item 1 sorted A → Z become apple, banana, item 1, item 2, item 10, Mango, Zebra. With case sensitive on, lines that differ only in case, such as “Apple” and “apple”, are treated as different, with the capitalised one first.
More worked examples
File names: natural sorting orders “chapter 2, chapter 10, chapter 1” as chapter 1, chapter 2, chapter 10, where a plain sort would put 10 before 2.
Common mistakes to avoid
- Expecting numbers to sort as text. Natural sort reads numbers as numbers, which is usually what you want.
- Forgetting blank lines. Keep “remove empty lines” ticked to avoid blank entries at the top.
- Leaving duplicates in. Tick “remove duplicates”, or use the remove duplicate lines tool to keep the original order.
Sources and methodology
The calculations on this page follow these published standards and references. The code is covered by automated tests against known values.