How to sort lines: alphabetically, by length, and why “10” comes before “9”
Sorting a list looks trivial — until you hit the classic trap: numbered lines line up as 1, 10, 11, 2, 3. Here's why that happens and which sorting mode fits which task.
Why “10” comes before “9”
By default, lines are sorted character by character, like words in a dictionary. The character “1” comes before “9”, so “10” and “100” land before “9” — alphabetical sorting knows nothing about numbers. For numbered lists (items, SKU codes, table rows) you need numeric mode: it reads lines as numbers and orders them by value: 1, 2, 3, …, 9, 10.
Three modes that cover everything
- Alphabetical — for names, surnames, and tags (case-sensitive or not — your choice);
- Numeric — for lists with numbers, so that 10 comes after 9;
- By line length — handy for spotting “odd” entries or ordering text from simple to complex before processing.
The pitfall: case and spaces
In the character table, uppercase letters come before lowercase, so without the right setting “Report” will sort before “invoice”. On top of that, an invisible trailing space shifts a line to an unexpected place. A good sorting tool solves both problems with “ignore case” and “trim extra spaces” checkboxes. Sort your list in the line sorting tool — paste the text, pick a mode, get the result, and tick “remove duplicates” to clean the list in the same step.
Sort Lines
Sort lines alphabetically, numerically, by length, or randomize with duplicate removal option
List Randomizer / Shuffle
Shuffle and randomize list items using the Fisher-Yates algorithm
Remove Duplicates
Remove duplicate lines from text with options for case sensitivity, trimming, and order preservation
Frequently asked questions
Why does "10" sort before "9"?
Because sorting is character-by-character: the first characters "1" and "9" are compared, and "1" comes earlier in the table. For a proper numeric order you need numeric mode — it compares values, not symbols.
Does letter case affect sorting?
Yes, standard sorting puts uppercase before lowercase: "Zebra" lands before "apple". Case-insensitive mode compares everything in lowercase and gives the familiar alphabetical order.
How do I sort a list alphabetically and remove duplicates?
Sort the lines with the "remove duplicates" option on — both steps happen in one pass, and the output is a clean alphabetical list with no repeats.