Line Sorter

0lines out
Sort methodOrder producedNumber-awareWhen it wins
Intl.Collator().compareLocale-aware A-ZYes (with numeric option)THE modern human sort - fast and correct
a.localeCompare(b)Locale-aware A-ZNoSimple text, small lists
(a>b)-(a<b) on parseFloatBy numeric valueYesRows that are numbers with labels
default .sort()UTF-16 code unitsNoNever for humans - '10' sorts before '9'
Reference: the MDN Intl.Collator guide - its numeric option sorts '2' before '10' and its compare function is reused internally, which also makes it FASTER than localeCompare per pair. Bottom line: the default sort is a code-unit sort wearing a friendly name - capitalized letters sort before lowercase (Z before a), numbers sort as text, and users read the result as random. Sort with a Collator, or sort by a normalized key (lowercased, punctuation-stripped) with the originals as payload.

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

  1. Paste your list into the input box.
  2. Choose A-Z or Z-A; toggle case-insensitive, remove blanks or dedupe as needed.
  3. 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.

Related tools