How to sort a list
- Paste your list into the top box, one item per line.
- Pick an order and tick the options you need. The Sorted box updates as you type or change a setting.
- Click Copy result or Download .txt. With Random order, Sort again gives you a fresh shuffle each time.
The six orders
- A → Z and Z → A – alphabetical order following the rules of a real language rather than raw character codes (more on that below).
- Shortest first and Longest first – by the number of characters in each line, spaces included. Lines of equal length are put in alphabetical order.
- Reverse current order – flips the list upside down without sorting it, so the last line comes first. Handy for turning an oldest-first log into newest-first.
- Random (shuffle) – mixes the lines using a Fisher–Yates shuffle driven by your browser's cryptographic random number generator.
The options
- Numbers in natural order (on by default) – runs of digits are compared as numbers, so “Item 2” comes before “Item 10”. With it off, text is compared character by character, and because “1” is smaller than “2”, “Item 10” comes first.
- Case-sensitive (off) – when off, “apple” and “Apple” are treated as equal and keep the order they had in your list. When on, capitals come first: APPLE, Apple, apple.
- Remove duplicates (off) – keeps only the first copy of each line. It follows the case setting, so with Case-sensitive off, “Apple” and “apple” count as duplicates.
- Remove empty lines (on) – drops blank lines and lines containing only spaces.
Examples
The sample list in the box is Banana, apple, Item 10, Item 2, cherry, one per line.
| Setting | Result |
|---|---|
| A → Z, natural order on | apple, Banana, cherry, Item 2, Item 10 |
| A → Z, natural order off | apple, Banana, cherry, Item 10, Item 2 |
| Z → A | Item 10, Item 2, cherry, Banana, apple |
| Longest first | Item 10, Banana, cherry, Item 2, apple |
| Reverse current order | cherry, Item 2, Item 10, apple, Banana |
File names show why natural order matters: file10.txt, file2.txt, file1.txt, File3.txt sorts to file1.txt, file2.txt, File3.txt, file10.txt with it on, but to file1.txt, file10.txt, file2.txt, File3.txt with it off, which is what a simple character-by-character comparison produces.
Why this isn't a plain “ASCII sort”
Many programming tools sort by character code, which puts every capital letter before every lowercase letter (“Zebra” before “apple”) and sends accented letters to the end. This tool uses the collation rules built into your browser instead, based on the Unicode Collation Algorithm: é sorts next to e, upper- and lowercase are interleaved, and digits come before letters. On this English page the rules of your browser's default language are used; the other language versions of the page use that language's rules, for example dictionary order for Korean or pinyin order for Chinese.
Sorting numbers: what natural order can't do
Natural order compares each run of digits as a whole number, which works for whole numbers and labels such as “Chapter 9”. It does not understand decimal points or minus signs:
- 10, 9.5, 1.25, 1.5, 2 sorts to 1.5, 1.25, 2, 9.5, 10, because the digits after the point are read as 5 and 25.
- -3, -10, 5, -1 sorts to -1, -3, -10, 5, because the minus sign is not treated as part of the number.
The fix for decimals is to write them with the same number of decimal places: 1.25, 1.50, 2.00, 9.50, 10.00 sorts correctly. For negative numbers or real numeric sorting, a spreadsheet is the better tool.
Tips
- Lines are compared exactly as written, so a line that starts with a space sorts before the others. If your list has stray spaces, clean it first with Remove Duplicate Lines, which trims spaces at both ends of each line (and drops repeated lines at the same time).
- Sorting both versions of a list before comparing them in the Diff Checker makes added and missing items much easier to spot.
- The whole line is compared from its first character. There is no way to sort by a column in the middle of the line, such as the second field of a CSV row; use a spreadsheet for that.
FAQ
Is the shuffle fair enough for a draw?
It uses a standard shuffle algorithm with cryptographically secure random numbers, so every order is, in practice, equally likely. To pick one or several winners from a list, the Random Name Picker is more convenient.
Do equal lines keep their original order?
Yes. The sort is stable: lines that compare as equal, such as “apple” and “Apple” with Case-sensitive off, stay in the order they had in your list.
Why do lines starting with numbers come first?
Standard collation places digits before letters, and punctuation and spaces before digits. This matches dictionary and file manager conventions in most languages.
Can I sort a very long list?
Yes. Lists of tens of thousands of lines sort almost instantly; the practical limit is your device's memory.