Natural sort that understands numbers
item2 comes before item10, not after — the classic lexicographic sorting bug that ruins file lists, version numbers and chapter orders.
Sort a list alphabetically, numerically, by length or into reverse order.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Sort lines of text online: A–Z, Z–A, natural numeric order, shortest first, by length, or shuffle. Deduplicate while sorting and copy the result instantly.
Sorting a list is easy until the list contains numbers. Then every naive implementation produces 1, 10, 100, 2, 20, 3 and you spend ten minutes working out why. The distinction between lexicographic and natural ordering is the single most useful thing to understand about sorting text.
Lexicographic sorting compares character by character using code-point order. It is fast, deterministic and completely wrong for anything containing digits, because it compares the characters 1 and 2 rather than the numbers 10 and 2.
Natural sorting tokenises each line into runs of digits and runs of non-digits, compares the non-digit runs lexicographically and the digit runs numerically. img2.png and img10.png share the prefix img, then 2 and 10 are compared as numbers, giving the order a human expects.
Case-insensitive sorting is what people almost always mean. It treats apple and Apple as equal and orders by the letters themselves. Case-sensitive ASCII sorting puts all uppercase before all lowercase, producing Zebra, apple, banana — occasionally useful for matching a specific system's behaviour, usually just confusing.
When two lines compare as equal under case-insensitive sorting, this tool falls back to a case-sensitive comparison so the order remains stable and reproducible rather than depending on the input arrangement.
A stable sort preserves the relative order of items that compare equal. JavaScript's Array.prototype.sort has been guaranteed stable since ES2019, so equal lines keep their input order. That matters when you sort a list of surname, firstname pairs by surname and expect ties to remain in their original sequence.
The dedupe and blank-line toggles run before sorting, which is the efficient order: fewer items to compare, and no empty lines cluttering the top of the result. For deeper cleaning — trimming internal whitespace, stripping punctuation — run the text through a cleaner first, then sort.
Step by step
Paste the list you want to sort, one item per line.
Pick a sort mode: alphabetical, numeric, natural, by length, or random shuffle.
Choose ascending or descending, and toggle case-sensitivity if it matters.
Optionally remove duplicates and blank lines in the same pass.
Press Sort and copy or download the ordered list.
Why use it
What this tool is good for, and what it deliberately does not try to do.
item2 comes before item10, not after — the classic lexicographic sorting bug that ruins file lists, version numbers and chapter orders.
Sorts lines that are pure numbers by value, so 100 lands after 99 rather than between 10 and 11.
Order by character count to find outliers, or reverse an existing order without re-sorting from scratch.
Sorting and duplicate removal together is the most common combination, so it is one toggle rather than two trips to two tools.
Questions
Short, honest answers about quality, limits and privacy.