Line Sorter
| Sort method | Order produced | Number-aware | When it wins |
|---|---|---|---|
Intl.Collator().compare | Locale-aware A-Z | Yes (with numeric option) | THE modern human sort - fast and correct |
a.localeCompare(b) | Locale-aware A-Z | No | Simple text, small lists |
(a>b)-(a<b) on parseFloat | By numeric value | Yes | Rows that are numbers with labels |
default .sort() | UTF-16 code units | No | Never for humans - '10' sorts before '9' |
Bottom line: sorting text is lexicographic, not numeric - which is why file10 sorts before file9 (1 comes before 9) and why a plain A-Z pass scatters version numbers and chapter titles. The case-insensitive option above is the everyday fix for the other classic: Apple and apple landing in two different worlds.
Paste any list โ names, keywords, URLs, tasks โ and sort the lines alphabetically in one pass. A-Z or Z-A, with case-insensitive comparison so 'apple' and 'Apple' sort together instead of by capital letter. Blank lines can be dropped, duplicates collapsed, and the line count updates live.
It pairs naturally with the duplicate remover for list cleaning: dedupe first, sort second, copy the result. Like every ToolDune text tool, it runs entirely in your browser โ private by architecture.
How to use
- Paste your list into the input box.
- Choose A-Z or Z-A; toggle case-insensitive, remove blanks or dedupe as needed.
- The sorted list and line count update live โ copy when it looks right.
Frequently asked questions
How do I alphabetize a list of names?
Paste the names one per line and click A-Z. Case-insensitive sorting keeps 'smith' and 'Smith' together instead of putting all lowercase names after all uppercase ones.
Does sorting change my original text?
No โ the sorted output appears in its own box. Your input stays untouched until you clear or edit it.
What does case-insensitive mean here?
The sort compares letters without caring about capitalization, which is what humans expect: 'banana' sorts between 'Apple' and 'Cherry' rather than at the end.
Is there a line limit?
The practical limit is browser memory โ tens of thousands of lines sort instantly. Nothing is uploaded; sorting is local JavaScript.
Why does file10 sort before file9?
Because computers compare character by character: 'file1...' matches 'file9...' on the f-i-l-e, then compares 1 against 9 - and 1 sorts first, so file10, file11 and file100 all line up before file9. Humans expect natural order (9 before 10), which is a different algorithm that chunks digits into numbers before comparing. When a sorted list looks wrong in exactly this way, it sorted correctly - just not the way people count.
How do I sort strings with numbers naturally - item2 before item10?
Use a Collator with numeric: true - new Intl.Collator(undefined, { numeric: true }).compare - which splits each string into digit runs and text runs and compares the digit runs as numbers, so item2, item9, item10 and item10a line up the way a human shelves them. The old recipe (parsing numbers out with a manual compare) breaks on mixed suffixes and costs more code; the Collator handles version strings, file names and part numbers with one option, and it composes with the sensitivity option for case-insensitive sorting.