Sort and Remove Duplicate Lines
Clean up a list: sort it, drop repeats, trim the whitespace.
Everything is processed in this tab. Nothing you paste is sent anywhere.
Every tool runs entirely in your browser. Your files are never uploaded to a server.
Sorting orders lines and deduplication removes repeats. The detail that matters is natural sorting: plain alphabetical order puts file10 before file2, because it compares character by character rather than reading the digits as a number.
How to use Sort & Deduplicate Lines
- Paste your list. One item per line — emails, filenames, IDs, anything.
- Choose how to sort. Natural order is what you want for anything numbered.
- Copy the cleaned list. Counts before and after are shown so you can see what was removed.
About sorting and deduplicating lines
List cleaning looks trivial and hides two genuine problems. The first is sort order. Comparing strings character by character is correct for words and wrong for anything containing numbers, which is why file10 lands before file2 and why a directory of invoices sorts into an order nobody wants. Natural sorting reads consecutive digits as a single number, and it is what almost everyone means by "sorted" when the items are numbered. There is a second layer beneath that: raw comparison uses character codes, so accented and non-Latin letters sort after Z rather than alongside their base letter, and uppercase sorts before all lowercase. Locale-aware collation fixes both and is what is used here. The second problem is invisible difference. Two lines that look identical frequently are not — a trailing space, a non-breaking space pasted from a web page, or a carriage return left by a Windows file will all defeat deduplication while showing nothing on screen. Trimming resolves most of it, and it is why the counts before and after are worth reading: a deduplication that removes nothing usually means the duplicates differ in a character you cannot see.
Frequently asked questions
Why does file10 come before file2 when I sort?
Does removing duplicates keep the first or last occurrence?
Why do two lines that look identical not count as duplicates?
Is sorting case-sensitive?
Last updated