This text sorter puts the lines of any list in order. Paste one item per line and pick a sort: A→Z or Z→A in natural order (so 2 comes before 10, and capitals don't jump to the top), shortest first, longest first, reverse the current order, or a fair shuffle. Three options can tidy the list at the same time: remove empty lines, remove duplicates and trim spaces. Then copy the result or clear the box.
If you only came to put names in alphabetical order: paste them, tap A→Z, copy. The rest of this page explains why the result looks "right" here when other tools sometimes get it oddly wrong.
file1, file10, file2: the problem with plain sorting
Most basic sorting compares text character by character using computer codes. That creates two strange results people run into all the time:
- "10" comes before "2", because the character "1" is smaller than "2".
- Every word starting with a capital letter comes before every lower-case word, because capitals have smaller codes.
Here's the same list sorted both ways:
| Your list | Plain character sort | This tool, A→Z (natural) |
|---|---|---|
| file1 | File3 | file1 |
| file10 | file1 | file2 |
| file2 | file10 | File3 |
| File3 | file2 | file10 |
Natural order reads numbers inside the text as whole numbers, so 2 sits before 10, and it ignores upper and lower case while comparing. That's the order a person would write by hand, and it's what you want for chapter lists, roll numbers, file names, "Item 9 / Item 12" style product names and so on. Z→A uses the same rules, just backwards.
Every sort button, and when I'd reach for it
- A→Z: names, glossaries, vocabulary lists, a bibliography you'll polish by hand later.
- Z→A: the same lists, backwards, or to see the highest numbered items first.
- Shortest first: sorts by line length. Useful for spotting the shortest keywords or the tightest headline options.
- Longest first: finds the longest entries quickly, for example names that might not fit on a certificate or ID card.
- Reverse current order: flips the list exactly as it is, without sorting. Turn 1 to 10 into 10 to 1 for a countdown, or show the newest entries of a log first.
- Shuffle: random order, fair to every line. More on that below.
A quick length example. This list:
Mumbai Delhi Thiruvananthapuram Pune
with "shortest first" becomes:
Pune Delhi Mumbai Thiruvananthapuram
Pune has 4 letters, Delhi 5, Mumbai 6 and Thiruvananthapuram 18.
Why this shuffle list is actually fair
A lot of quick code online shuffles a list by "sorting it randomly", asking the computer to flip a coin each time it compares two items. It looks random, but it isn't fair. Depending on the browser, some items tend to stay near where they started, so the first name in your list may win more often than it should.
This page uses the Fisher–Yates shuffle instead. In plain words: it picks a random line from the whole list for the last spot, then a random line from what's left for the spot before it, and so on until every spot is filled. Each line gets an equal chance at every position, and every possible order is equally likely.
That makes it fine for:
- deciding the speaking order for class presentations,
- a casual draw or raffle order among friends or a small club,
- shuffling quiz questions or flashcards so you don't memorise the order,
- picking who goes first in a game.
For anything with money or legal rules attached (an official lucky draw, say), use a method your organisers can audit and repeat, and record how the draw was done. A browser shuffle can't be replayed later to prove the result.
The three cleanup options
Real lists are messy, so you can tick these before sorting:
- Remove empty lines stops blank lines from collecting at the top of an A→Z sort.
- Remove duplicates keeps one copy of each repeated line.
- Trim spaces removes spaces at the start and end of lines, so " Amit" doesn't sort differently from "Amit".
If you need finer control over duplicates, like ignoring capital letters or listing only the lines that repeated, use the duplicate line remover first and then sort the result here.
Sort lines from other tools on the site
The sorter pairs well with a few of the other tools:
- Make a numbered list with the number list generator, then use reverse for a countdown.
- Generate practice words with the random word generator, then sort them A→Z for a vocabulary sheet.
- Build a long test list with the line repeater and shuffle it to check how your app handles random order.
Where this text sorter falls short
- It sorts whole lines only. If your items sit on one line separated by commas, put each on its own line first.
- No column sorting. For a table where you want to sort by the second column (marks, prices), use a spreadsheet.
- Language-specific rules. A→Z works well for English and is fine for most everyday lists, but dictionary order for Hindi, or for names with special prefixes, may follow conventions it doesn't know about.
- No undo history. Reverse flips what is currently in the box, so if you shuffled by accident, paste your original list again.
Everything happens in your browser, so you can sort a list online without signing up or sending your names and notes to a server. Paste, pick a sort, copy. That's the whole job, done the way a careful person would do it by hand, only faster.