Sort Lines Alphabetically — Free Online Line Sorter
A→Z, Z→A, natural order, by length, reversed or shuffled — one click each.
🔒 Runs in your browser — files never uploaded ⚡ No signup 💯 Free
Paste your lines and put them in order with one click: alphabetical in either direction, natural order that handles numbers properly, shortest or longest first, reversed, or shuffled. Options for case, trimming and duplicates apply to whichever sort you pick.
The one to know about is natural sort. A plain alphabetical sort puts file10 before file2, because character by character "1" comes before "2". Natural sort reads the numbers as numbers, which is what you want for filenames, versions and anything numbered.
How to use Sort Lines
- Paste your text, one item per line.
- Set the options — case sensitivity, trimming, duplicate removal.
- Click a sort order. The result appears immediately; clicking a different order re-sorts the same input.
- Copy or download the result, or feed it back in as input for another pass.
Alphabetical vs natural: when it matters
For ordinary words the two agree. They part company as soon as numbers are involved:
- Plain A→Z:
item1, item10, item100, item2, item20 - Natural:
item1, item2, item10, item20, item100
Version numbers, invoice IDs, chapter files, IP addresses — anything where digits carry meaning sorts sensibly under natural order and bizarrely under plain alphabetical. If your list has no numbers, it makes no difference; if it does, natural is almost always what you meant.
The other orders
- By length — shortest or longest first, with ties broken alphabetically. Useful for spotting outliers in a list of titles or slugs, or crossword and word-game lists.
- Reverse order — flips the current order top to bottom without sorting. Turn a chronological log into newest-first, exactly as it was, backwards.
- Shuffle — a genuinely uniform random order (Fisher–Yates with cryptographic randomness, the same approach as our random picker) — not the biased sort-by-coin-flip trick.
Case sensitivity in sorting
With "ignore case" on, apple and Apple sort next to each other, which is what dictionaries and most humans expect. Turned off, sorting is by character code — all the capitals first, then the lowercase letters. That's occasionally exactly what you need (separating constants from variables, say), which is why it's a switch and not a fixed rule.
Frequently asked questions
What is natural sort and when do I want it?
Natural sort reads runs of digits as numbers, so file2 comes before file10. Plain alphabetical compares character by character, putting file10 first because "1" < "2". Any list with meaningful numbers in it — filenames, versions, invoice IDs — wants natural sort.
How are capital letters sorted?
With "ignore case" on (the default), apple and Apple sort together, like a dictionary. Off, sorting follows character codes — capitals as a block before lowercase. Both behaviours have their uses, which is why it's an option rather than a fixed rule.
Is the shuffle actually random?
Yes — it's a Fisher–Yates shuffle driven by the browser's cryptographic random generator, so every ordering is equally likely. The popular trick of sorting by a random comparator is genuinely biased; some orderings come up measurably more often. We don't do that.
Can I sort numbers?
Yes — use Natural order, which compares them numerically: 2, 10, 100 instead of the alphabetical 10, 100, 2. Decimals sort correctly for the integer part; scientific notation and mixed signs are beyond what a line sorter should pretend to handle.
Does sorting remove duplicates too?
Only if you tick "Remove duplicates". Sorting brings identical lines together, which makes duplicates easy to see, but nothing is removed unless you ask. For deduplication with more control, use the duplicate remover.
Is my text uploaded anywhere?
No — sorting happens entirely in your browser, and the text never leaves your machine. Paste-and-sort is safe even for lists you wouldn't email.