Sort Lines Online - Alphabetize and Remove Duplicates
Sort lines and remove duplicates
How to sort lines and remove duplicates
Paste any list with one item per line: names, email addresses, keywords, file names, product codes. The result updates as you type. Spaces at the ends of lines and empty lines are cleaned first, so "apple" and "apple " count as the same line. Nothing is uploaded; the sorting happens in your browser.
Three steps
- 1 Paste your list into the left box, one item per line.
- 2 Pick an order and tick the clean-up options you want: duplicates, case, spaces, empty lines.
- 3 Check the line counts under the boxes and copy the result.
Why does file10 come before file2?
Plain alphabetical sorting compares character by character, and the character "1" comes before "2", so file10, file11 and file100 all land before file2. Natural order reads a run of digits as one number, which puts file2 before file10 the way people expect. Use natural order for file names, versions, chapters and anything numbered; use plain A → Z only when you need strict character order.
Alphabetical order depends on the language
A naive sort compares character codes, which puts every capital letter before every small one (Zebra before apple) and accented letters after z (Éclair after zebra). This tool sorts with the rules of the page language instead: capitals and small letters are mixed in true alphabetical order, accented letters sit next to their base letter, and languages with their own alphabet order are respected, for example Turkish ç after c and ı before i, or Spanish ñ after n.
How duplicates are found
Two lines are duplicates when they are exactly the same after trimming. The first one is kept and later copies are dropped, so "Keep original order" with duplicate removal gives you a clean list without reshuffling it. With "Ignore case" on, Apple, APPLE and apple count as one line and the first spelling wins. Check the counter: if far more lines disappear than you expected, look for near-duplicates such as a missing letter.
A fair shuffle
Shuffle uses the Fisher-Yates method with the browser’s cryptographic random generator, so every possible order is equally likely. The popular shortcut of "sorting with a random comparison" is biased: some items tend to stay near where they started. For a giveaway or a random speaking order, paste the names, pick Shuffle and press "Shuffle again" for a fresh draw.