🔃 Sort Lines
Paste lines, choose an order, alphabetical, by length, reversed or random shuffle.
4 lines sorted
How the sort lines works
Alphabetical modes use natural, case-insensitive ordering, so "item 2" correctly sorts before "item 10" (a plain character sort would reverse them). Length modes compare character counts; shuffle applies an unbiased Fisher, Yates permutation. Natural ordering compares text in chunks, treating each embedded run of digits as a single number, so numeric segments sort by value while letters sort alphabetically; equal chunks fall through to the next character.
Natural ordering is the quiet superpower here: filenames, version numbers and numbered lists sort the way humans expect instead of the way ASCII does.
Frequently asked questions
Why does "item 10" sort after "item 2" here but not in other tools?
This tool uses natural ordering, which compares embedded numbers by value. Plain character sorting puts "10" before "2" because the character 1 precedes 2.
Is the sort case-sensitive?
No, "apple" and "Apple" sort together. Case is preserved in the output, just not used to separate entries.
Is the shuffle really random?
It uses the Fisher, Yates algorithm with the browser’s random source, unbiased for everyday use (raffles, random orders), though not cryptographic-grade.
Can I sort and deduplicate together?
Run remove-duplicate-lines first, then sort, two clicks, and the pair of tools link to each other.
How do I sort a list from Z to A?
Choose "Z → A". It applies the same natural, case-insensitive ordering as A → Z but in reverse, so the list runs from last to first.
What is the difference between "reverse current order" and "Z → A"?
"Z → A" sorts alphabetically descending; "reverse current order" simply flips your list as it stands without sorting, which is what you want to invert an already-ordered list.
Does sorting remove duplicate lines?
No, every line is kept, so identical entries end up next to each other. Run the remove-duplicate-lines tool before or after sorting if you want a unique, ordered list.
Where do blank lines end up when sorting A → Z?
Blank lines group together at the top of an ascending sort, since an empty string sorts before any text. Numbered lines then follow in natural order, so "item 2" lands before "item 10" because the digit runs compare by value.
Does my list leave the browser?
No, sorting is local, instant and works offline.